info on shutting down Person by Mozilla

This commit is contained in:
Filip Gralinski 2016-12-03 14:33:55 +01:00
parent 72586a6dc7
commit 6ab6bcdab4
3 changed files with 19 additions and 10 deletions

View File

@ -1,8 +1,6 @@
module Handler.Home where module Handler.Home where
import Import import Import
import Yesod.Form.Bootstrap3 (BootstrapFormLayout (..), renderBootstrap3,
withSmallInput)
import Handler.Shared import Handler.Shared

View File

@ -25,16 +25,20 @@ getYourAccountR = do
postYourAccountR :: Handler Html postYourAccountR :: Handler Html
postYourAccountR = do postYourAccountR = do
((result, formWidget), formEnctype) <- runFormPost (yourAccountForm Nothing Nothing Nothing) ((result, formWidget), formEnctype) <- runFormPost (yourAccountForm Nothing Nothing Nothing)
userId <- requireAuthId
let accountData = case result of let accountData = case result of
FormSuccess res -> Just res FormSuccess res -> Just res
_ -> Nothing _ -> Nothing
Just (name, localId, mPassword, sshPubKey, avatarFile) = accountData case accountData of
userId <- requireAuthId Just (name, localId, mPassword, sshPubKey, avatarFile) -> do
updateUserAccount userId name localId mPassword sshPubKey avatarFile updateUserAccount userId name localId mPassword sshPubKey avatarFile
Nothing -> do
setMessage $ toHtml ("Something went wrong, probably the password did not match" :: Text)
defaultLayout $ do defaultLayout $ do
setTitle "Your account" setTitle "Your account"
$(widgetFile "your-account") $(widgetFile "your-account")
yourAccountForm :: Maybe Text -> Maybe Text -> Maybe Text -> Form (Maybe Text, Maybe Text, Maybe Text, Maybe Text, Maybe FileInfo) yourAccountForm :: Maybe Text -> Maybe Text -> Maybe Text -> Form (Maybe Text, Maybe Text, Maybe Text, Maybe Text, Maybe FileInfo)
yourAccountForm maybeName maybeLocalId maybeSshPubKey = renderBootstrap3 BootstrapBasicForm $ (,,,,) yourAccountForm maybeName maybeLocalId maybeSshPubKey = renderBootstrap3 BootstrapBasicForm $ (,,,,)
<$> aopt textField (bfs MsgAccountName) (Just maybeName) <$> aopt textField (bfs MsgAccountName) (Just maybeName)
@ -133,7 +137,7 @@ passwordConfirmField = Field
| otherwise -> return $ Left "Passwords don't match" | otherwise -> return $ Left "Passwords don't match"
[] -> return $ Right Nothing [] -> return $ Right Nothing
_ -> return $ Left "You must enter two values" _ -> return $ Left "You must enter two values"
, fieldView = \idAttr nameAttr otherAttrs eResult isReq -> , fieldView = \idAttr nameAttr otherAttrs _ _ ->
[whamlet| [whamlet|
<input id=#{idAttr} name=#{nameAttr} *{otherAttrs} type=password> <input id=#{idAttr} name=#{nameAttr} *{otherAttrs} type=password>
<div>confirm: <div>confirm:

View File

@ -9,7 +9,13 @@
<li class="list-group-item">free & open-source (AGPL), you can use it your own, in your company, at your university, etc. (git repo: <tt><a href="#{browsableGitRepo "gonito"}">git://gonito.net/gonito</a></tt>) <li class="list-group-item">free & open-source (AGPL), you can use it your own, in your company, at your university, etc. (git repo: <tt><a href="#{browsableGitRepo "gonito"}">git://gonito.net/gonito</a></tt>)
<li class="list-group-item">git-based (challenges and solutions are submitted only with git). <li class="list-group-item">git-based (challenges and solutions are submitted only with git).
$maybe _ <- maybeUser $maybe user <- maybeUser
$maybe _ <- userPassword $ entityVal user
$nothing
<div class="alert alert-info" role="alert">
<p>
<strong>Please set up your password at <a href="@{YourAccountR}">your account</a> so that you could log in when <a href="https://developer.mozilla.org/en-US/Persona">Persona</a> authentication system.
$maybe _ <- maybeLocalId $maybe _ <- maybeLocalId
<p>Go to the <a href="@{ListChallengesR}">challenge list</a> and choose a challenge for you! <p>Go to the <a href="@{ListChallengesR}">challenge list</a> and choose a challenge for you!
$nothing $nothing
@ -25,5 +31,6 @@
Gonito uses <a href="https://developer.mozilla.org/en-US/Persona">Persona</a> authentication system available in Mozilla Firefox. Other authentication systems are on the way, but for the time being you need to use Firefox. Gonito uses <a href="https://developer.mozilla.org/en-US/Persona">Persona</a> authentication system available in Mozilla Firefox. Other authentication systems are on the way, but for the time being you need to use Firefox.
<p>So, just click <a href="@{AuthR LoginR}">log in</a>, then "Sign in with Persona" button and Firefox will guide you! <p>So, just click <a href="@{AuthR LoginR}">log in</a>, then "Sign in with Persona" button and Firefox will guide you!
<p>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.
<p class="text-muted text-right"><sup>*</sup>Disclaimer: Gonito is neither affiliated with nor endorsed by <a href="https://www.kaggle.com">Kaggle</a>. <p class="text-muted text-right"><sup>*</sup>Disclaimer: Gonito is neither affiliated with nor endorsed by <a href="https://www.kaggle.com">Kaggle</a>.