diff options
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 |