diff --git a/models/users.model b/models/users.model index 7a2849968..a69e801ef 100644 --- a/models/users.model +++ b/models/users.model @@ -14,8 +14,8 @@ User json -- Each Uni2work user has a corresponding row in this table; created upon first login. ident UserIdent -- Case-insensitive user-identifier - passwordHash Text Maybe -- If specified, allows the user to login with credentials independently of external authentication - lastLogin UTCTime Maybe -- When did the user last authenticate? + passwordHash Text Maybe -- If specified, allows the user to login with credentials independently of external authentication + lastAuthentication UTCTime Maybe -- When did the user last authenticate? surname UserSurname -- Display user names always through 'nameWidget displayName surname' displayName UserDisplayName displayEmail UserEmail diff --git a/src/Foundation/Yesod/Auth.hs b/src/Foundation/Yesod/Auth.hs index 17a64afec..942845cb4 100644 --- a/src/Foundation/Yesod/Auth.hs +++ b/src/Foundation/Yesod/Auth.hs @@ -117,7 +117,7 @@ authenticate creds@Creds{..} = liftHandler . runDB . withReaderT projectBackend -> return () case res of Authenticated uid - | not isDummy -> res <$ update uid [ UserLastLogin =. Just now ] + | not isDummy -> res <$ update uid [ UserLastAuthentication =. Just now ] _other -> return res $logDebugS "Auth" $ tshow Creds{..} @@ -389,7 +389,7 @@ decodeUser now UserDefaultConf{..} upsertData = do , userPinPassword = Nothing -- must be derived via AVS , userPrefersPostal = userDefaultPrefersPostal , userPasswordHash = Nothing - , userLastLogin = Nothing + , userLastAuthentication = Nothing , .. } userUpdate = diff --git a/src/Handler/Utils/Users.hs b/src/Handler/Utils/Users.hs index e906e59d2..14d18c3b2 100644 --- a/src/Handler/Utils/Users.hs +++ b/src/Handler/Utils/Users.hs @@ -910,7 +910,7 @@ assimilateUser newUserId oldUserId = mapReaderT execWriterT $ do update newUserId $ catMaybes -- NOTE: persist does shortcircuit null updates as expected [ mergeMaybe UserPasswordHash - , mergeBy (>) UserLastLogin + , mergeBy (>) UserLastAuthentication , mergeBy (<) UserCreated , toMaybe (not (validEmail' (newUser ^. _userEmail )) && validEmail' (oldUser ^. _userEmail)) (UserEmail =. oldUser ^. _userEmail) diff --git a/src/Utils/Users.hs b/src/Utils/Users.hs index 24c588fb1..20b9bcd37 100644 --- a/src/Utils/Users.hs +++ b/src/Utils/Users.hs @@ -44,7 +44,7 @@ addNewUser AddUserData{..} = do let newUser = User { userIdent = audIdent - , userLastLogin = Nothing + , userLastAuthentication = Nothing , userPasswordHash = Nothing , userMaxFavourites = userDefaultMaxFavourites , userMaxFavouriteTerms = userDefaultMaxFavouriteTerms