Skip to content

Commit

Permalink
Rename maxFailedLoginAttemps to maxFailedLoginAttempts
Browse files Browse the repository at this point in the history
  • Loading branch information
s0kil committed Apr 2, 2022
1 parent ff78747 commit a2c6c07
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions IHP/AuthSupport/Controller/Sessions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ newSessionAction = do

-- | Logs in a user when a valid email and password is given
--
-- After 10 failed attempts, the user is locked for an hours. See 'maxFailedLoginAttemps' to customize this.
-- After 10 failed attempts, the user is locked for an hours. See 'maxFailedLoginAttempts' to customize this.
--
-- After a successful login, the user is redirect to 'afterLoginRedirectPath'.
createSessionAction :: forall record action.
Expand Down Expand Up @@ -91,7 +91,7 @@ createSessionAction = do
user :: record <- user
|> incrementField #failedLoginAttempts
|> updateRecord
when (get #failedLoginAttempts user >= maxFailedLoginAttemps user) do
when (get #failedLoginAttempts user >= maxFailedLoginAttempts user) do
Lockable.lock user
pure ()
redirectTo buildNewSessionAction
Expand Down Expand Up @@ -154,8 +154,8 @@ class ( Typeable record
afterLoginRedirectPath = "/"

-- | After 10 failed login attempts the user will be locked for an hour
maxFailedLoginAttemps :: record -> Int
maxFailedLoginAttemps _ = 10
maxFailedLoginAttempts :: record -> Int
maxFailedLoginAttempts _ = 10

-- | Callback that is executed just before the user is logged
--
Expand All @@ -178,4 +178,4 @@ class ( Typeable record
--
usersQueryBuilder :: (GetModelByTableName (GetTableName record) ~ record, Table record) => QueryBuilder (GetTableName record)
usersQueryBuilder = query @record
{-# INLINE usersQueryBuilder #-}
{-# INLINE usersQueryBuilder #-}

0 comments on commit a2c6c07

Please sign in to comment.