mirror of
https://github.com/netbirdio/netbird.git
synced 2025-07-14 21:35:23 +02:00
Prevent setting zero user last login
Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
This commit is contained in:
@ -886,6 +886,10 @@ func (s *SqlStore) GetAccountSettings(ctx context.Context, lockStrength LockingS
|
|||||||
|
|
||||||
// SaveUserLastLogin stores the last login time for a user in DB.
|
// SaveUserLastLogin stores the last login time for a user in DB.
|
||||||
func (s *SqlStore) SaveUserLastLogin(ctx context.Context, accountID, userID string, lastLogin time.Time) error {
|
func (s *SqlStore) SaveUserLastLogin(ctx context.Context, accountID, userID string, lastLogin time.Time) error {
|
||||||
|
if lastLogin.IsZero() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var user types.User
|
var user types.User
|
||||||
result := s.db.First(&user, accountAndIDQueryCondition, accountID, userID)
|
result := s.db.First(&user, accountAndIDQueryCondition, accountID, userID)
|
||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
|
Reference in New Issue
Block a user