diff --git a/Handler/Home.hs b/Handler/Home.hs index eddfbbd..c1ac281 100644 --- a/Handler/Home.hs +++ b/Handler/Home.hs @@ -1,8 +1,6 @@ module Handler.Home where import Import -import Yesod.Form.Bootstrap3 (BootstrapFormLayout (..), renderBootstrap3, - withSmallInput) import Handler.Shared diff --git a/Handler/YourAccount.hs b/Handler/YourAccount.hs index 062d712..641a4b6 100644 --- a/Handler/YourAccount.hs +++ b/Handler/YourAccount.hs @@ -25,15 +25,19 @@ getYourAccountR = do postYourAccountR :: Handler Html postYourAccountR = do ((result, formWidget), formEnctype) <- runFormPost (yourAccountForm Nothing Nothing Nothing) + userId <- requireAuthId let accountData = case result of FormSuccess res -> Just res _ -> Nothing - Just (name, localId, mPassword, sshPubKey, avatarFile) = accountData - userId <- requireAuthId - updateUserAccount userId name localId mPassword sshPubKey avatarFile + case accountData of + Just (name, localId, mPassword, sshPubKey, avatarFile) -> do + updateUserAccount userId name localId mPassword sshPubKey avatarFile + Nothing -> do + setMessage $ toHtml ("Something went wrong, probably the password did not match" :: Text) defaultLayout $ do - setTitle "Your account" - $(widgetFile "your-account") + setTitle "Your account" + $(widgetFile "your-account") + yourAccountForm :: Maybe Text -> Maybe Text -> Maybe Text -> Form (Maybe Text, Maybe Text, Maybe Text, Maybe Text, Maybe FileInfo) yourAccountForm maybeName maybeLocalId maybeSshPubKey = renderBootstrap3 BootstrapBasicForm $ (,,,,) @@ -133,7 +137,7 @@ passwordConfirmField = Field | otherwise -> return $ Left "Passwords don't match" [] -> return $ Right Nothing _ -> return $ Left "You must enter two values" - , fieldView = \idAttr nameAttr otherAttrs eResult isReq -> + , fieldView = \idAttr nameAttr otherAttrs _ _ -> [whamlet|
+ Please set up your password at your account so that you could log in when Persona authentication system.
+
$maybe _ <- maybeLocalId
Go to the challenge list and choose a challenge for you!
$nothing
@@ -25,5 +31,6 @@
Gonito uses Persona authentication system available in Mozilla Firefox. Other authentication systems are on the way, but for the time being you need to use Firefox.
So, just click log in, then "Sign in with Persona" button and Firefox will guide you!
-
+ Unfortunately, Persona will be shut down soon :( Don't worry, just sign in with Persona and then set up a password, so that you could log in even when Persona is closed.
+
*Disclaimer: Gonito is neither affiliated with nor endorsed by Kaggle.