aboutsummaryrefslogtreecommitdiff
path: root/src/server/Model
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-07-19 19:20:00 +0200
committerJoris Guyonvarch2015-07-19 19:20:00 +0200
commit3aeb5db40424863039651d10593c1c0be49efd7b (patch)
treeaed3f954ed9f9428f7a1b913e1d6a4b0e991cf23 /src/server/Model
parentf687b15d4d3f55fb231cd03b773b163ed131b129 (diff)
Adding a 2 minutes expiration time for a login token
Diffstat (limited to 'src/server/Model')
-rw-r--r--src/server/Model/SignIn.hs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/server/Model/SignIn.hs b/src/server/Model/SignIn.hs
index c447416..0f9c6ce 100644
--- a/src/server/Model/SignIn.hs
+++ b/src/server/Model/SignIn.hs
@@ -1,7 +1,7 @@
module Model.SignIn
( createSignInToken
, getSignInToken
- , signInTokenIsUsed
+ , signInTokenToUsed
) where
import Data.Text (Text)
@@ -23,12 +23,8 @@ createSignInToken email = do
getSignInToken :: Text -> Persist (Maybe (Entity SignIn))
getSignInToken token =
- selectFirst
- [ SignInToken ==. token
- , SignInIsUsed ==. False
- ]
- []
+ selectFirst [SignInToken ==. token] []
-signInTokenIsUsed :: SignInId -> Persist ()
-signInTokenIsUsed tokenId =
+signInTokenToUsed :: SignInId -> Persist ()
+signInTokenToUsed tokenId =
update tokenId [SignInIsUsed =. True]