clarification as regards passwords
This commit is contained in:
parent
2f0c453ecc
commit
106db0d14d
@ -26,6 +26,7 @@ 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
|
userId <- requireAuthId
|
||||||
|
user <- runDB $ get404 userId
|
||||||
let accountData = case result of
|
let accountData = case result of
|
||||||
FormSuccess res -> Just res
|
FormSuccess res -> Just res
|
||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
@ -73,6 +74,7 @@ updatePassword _ Nothing = return ()
|
|||||||
updatePassword userId (Just password) = do
|
updatePassword userId (Just password) = do
|
||||||
encodedPassword <- liftIO $ makePassword (encodeUtf8 password) defaultStrength
|
encodedPassword <- liftIO $ makePassword (encodeUtf8 password) defaultStrength
|
||||||
runDB $ update userId [UserPassword =. Just (decodeUtf8 encodedPassword)]
|
runDB $ update userId [UserPassword =. Just (decodeUtf8 encodedPassword)]
|
||||||
|
setMessage $ toHtml ("Password set!" :: Text)
|
||||||
|
|
||||||
updateAvatar :: Key User -> Maybe FileInfo -> Handler ()
|
updateAvatar :: Key User -> Maybe FileInfo -> Handler ()
|
||||||
updateAvatar _ Nothing = return ()
|
updateAvatar _ Nothing = return ()
|
||||||
@ -140,7 +142,7 @@ passwordConfirmField = Field
|
|||||||
, fieldView = \idAttr nameAttr otherAttrs _ _ ->
|
, 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 new password:
|
||||||
<input id=#{idAttr}-confirm name=#{nameAttr} *{otherAttrs} type=password>
|
<input id=#{idAttr}-confirm name=#{nameAttr} *{otherAttrs} type=password>
|
||||||
|]
|
|]
|
||||||
, fieldEnctype = UrlEncoded
|
, fieldEnctype = UrlEncoded
|
||||||
|
@ -25,4 +25,4 @@ CommentText: Write a comment
|
|||||||
Send: Send
|
Send: Send
|
||||||
Avatar: avatar
|
Avatar: avatar
|
||||||
About: about
|
About: about
|
||||||
Password: password
|
Password: new password
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
$nothing
|
$nothing
|
||||||
<div class="alert alert-info" role="alert">
|
<div class="alert alert-info" role="alert">
|
||||||
<p>
|
<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
|
$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!
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
<div id="main" role="main">
|
<div id="main" role="main">
|
||||||
<h2>Your account
|
<h2>Your account
|
||||||
<hr>
|
<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}>
|
<img style="max-width:80px;padding-bottom:30px" src=@{AvatarR userId}>
|
||||||
<form method=post action=@{YourAccountR}#form enctype=#{formEnctype}>
|
<form method=post action=@{YourAccountR}#form enctype=#{formEnctype}>
|
||||||
^{formWidget}
|
^{formWidget}
|
||||||
|
Loading…
Reference in New Issue
Block a user