Skip to content

Commit

Permalink
Allow multiple signin with email link when not yet expired
Browse files Browse the repository at this point in the history
  • Loading branch information
s-gv committed Oct 3, 2021
1 parent 96b074c commit c876763
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions models/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,9 @@ func GetUserByOneTimeToken(domainID int, oneTimeToken string) *User {
if user.DomainID != domainID {
return nil
}
if !user.OnetimeLoginTokenAt.Valid || user.OnetimeLoginTokenAt.Time.Add(4*time.Hour).Before(time.Now()) {
if !user.OnetimeLoginTokenAt.Valid || user.OnetimeLoginTokenAt.Time.Add(2*time.Hour).Before(time.Now()) {
return nil
}
_, e := DB.Exec("UPDATE users SET onetime_login_token_at = to_timestamp(0) WHERE user_id=$1;", user.UserID)
if e != nil {
glog.Errorf("Error resetting onetime sign-in token creation time: %s", e)
}
return &user
}

Expand Down

0 comments on commit c876763

Please sign in to comment.