clarification as regards passwords
This commit is contained in:
parent
2f0c453ecc
commit
106db0d14d
@ -26,6 +26,7 @@ postYourAccountR :: Handler Html
|
||||
postYourAccountR = do
|
||||
((result, formWidget), formEnctype) <- runFormPost (yourAccountForm Nothing Nothing Nothing)
|
||||
userId <- requireAuthId
|
||||
user <- runDB $ get404 userId
|
||||
let accountData = case result of
|
||||
FormSuccess res -> Just res
|
||||
_ -> Nothing
|
||||
@ -73,6 +74,7 @@ updatePassword _ Nothing = return ()
|
||||
updatePassword userId (Just password) = do
|
||||
encodedPassword <- liftIO $ makePassword (encodeUtf8 password) defaultStrength
|
||||
runDB $ update userId [UserPassword =. Just (decodeUtf8 encodedPassword)]
|
||||
setMessage $ toHtml ("Password set!" :: Text)
|
||||
|
||||
updateAvatar :: Key User -> Maybe FileInfo -> Handler ()
|
||||
updateAvatar _ Nothing = return ()
|
||||
@ -140,7 +142,7 @@ passwordConfirmField = Field
|
||||
, fieldView = \idAttr nameAttr otherAttrs _ _ ->
|
||||
[whamlet|
|
||||
<input id=#{idAttr} name=#{nameAttr} *{otherAttrs} type=password>
|
||||
<div>confirm:
|
||||
<div>confirm new password:
|
||||
<input id=#{idAttr}-confirm name=#{nameAttr} *{otherAttrs} type=password>
|
||||
|]
|
||||
, fieldEnctype = UrlEncoded
|
||||
|
@ -25,4 +25,4 @@ CommentText: Write a comment
|
||||
Send: Send
|
||||
Avatar: avatar
|
||||
About: about
|
||||
Password: password
|
||||
Password: new password
|
||||
|
@ -14,7 +14,7 @@
|
||||
$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.
|
||||
<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 is shut down.
|
||||
|
||||
$maybe _ <- maybeLocalId
|
||||
<p>Go to the <a href="@{ListChallengesR}">challenge list</a> and choose a challenge for you!
|
||||
|
@ -2,6 +2,11 @@
|
||||
<div id="main" role="main">
|
||||
<h2>Your account
|
||||
<hr>
|
||||
$maybe _ <- userPassword user
|
||||
$nothing
|
||||
<div class="alert alert-info" role="alert">
|
||||
<p>
|
||||
<strong>Please set up your password below so that you could log in when <a href="https://developer.mozilla.org/en-US/Persona">Persona</a> authentication system is shut down.
|
||||
<img style="max-width:80px;padding-bottom:30px" src=@{AvatarR userId}>
|
||||
<form method=post action=@{YourAccountR}#form enctype=#{formEnctype}>
|
||||
^{formWidget}
|
||||
|
Loading…
Reference in New Issue
Block a user