diff options
author | Joris | 2016-03-23 00:45:33 +0100 |
---|---|---|
committer | Joris | 2016-03-23 00:46:53 +0100 |
commit | a11ad41b52ed3682d33382f2a378bf3294d688b2 (patch) | |
tree | f1d0f7835965ebcc6a61225186cad6b5de565bca /src/server/Main.hs | |
parent | 32db6a74d8578f993dd1cce3367fc7615ec730cd (diff) |
Sign in token link to /
Diffstat (limited to 'src/server/Main.hs')
-rw-r--r-- | src/server/Main.hs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/server/Main.hs b/src/server/Main.hs index 998b394..5688324 100644 --- a/src/server/Main.hs +++ b/src/server/Main.hs @@ -35,7 +35,17 @@ main = do middleware $ staticPolicy (noDots >-> addBase "public") - get "/" (getIndex conf) + get "/" $ + ( do + signInToken <- param "signInToken" :: ActionM Text + successOrError <- validateSignIn conf signInToken + case successOrError of + Left errorKey -> + (getIndex conf (Just errorKey)) + Right _ -> + (getIndex conf Nothing) + ) `rescue` (\_ -> getIndex conf Nothing) + post "/signOut" signOut -- SignIn @@ -44,10 +54,6 @@ main = do email <- param "email" :: ActionM Text signIn conf email - get "/validateSignIn" $ do - token <- param "token" :: ActionM Text - validateSignIn conf token - -- Users get "/users" getUsers |