mirror of
https://github.com/netbirdio/netbird.git
synced 2025-01-10 07:58:32 +01:00
Prevent setting zero user last login
Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
This commit is contained in:
parent
34d26d44b0
commit
ca40247b15
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user