trying to switch off autocomplete in account settings (not fully possible)

This commit is contained in:
Filip Gralinski 2017-09-23 14:51:15 +02:00
parent 2729ccd68f
commit 8be73e73a1
3 changed files with 7 additions and 4 deletions

View File

@ -31,9 +31,9 @@ passwordConfirmField = Field
_ -> return $ Left "You must enter two values"
, fieldView = \idAttr nameAttr otherAttrs _ _ ->
[whamlet|
<input id=#{idAttr} name=#{nameAttr} *{otherAttrs} type=password>
<input id=#{idAttr} name=#{nameAttr} *{otherAttrs} type=text autocomplete="new-password" onfocus="$(this).attr('type', 'password');">
<div>re-enter the password
<input id=#{idAttr}-confirm name=#{nameAttr} *{otherAttrs} type=password>
<input id=#{idAttr}-confirm name=#{nameAttr} *{otherAttrs} type=text autocomplete="new-password" onfocus="$(this).attr('type', 'password');">
|]
, fieldEnctype = UrlEncoded
}

View File

@ -48,10 +48,13 @@ checkPassword Nothing = True
checkPassword (Just "") = True
checkPassword (Just passwd) = isPasswordAcceptable passwd
autocompleteOff name = setts { fsAttrs = (fsAttrs setts) ++ [("autocomplete", "nope")]}
where setts = (bfs name)
yourAccountForm :: Maybe Text -> Maybe Text -> Maybe Text -> Bool -> Form (Maybe Text, Maybe Text, Maybe Text, Maybe Text, Maybe FileInfo, Bool)
yourAccountForm maybeName maybeLocalId maybeSshPubKey anonimised = renderBootstrap3 BootstrapBasicForm $ (,,,,,)
<$> aopt textField (bfs MsgAccountName) (Just maybeName)
<*> aopt textField (bfs MsgId) (Just maybeLocalId)
<*> aopt textField (autocompleteOff MsgId) (Just maybeLocalId)
<*> aopt passwordConfirmField (bfs MsgPassword) Nothing
<*> aopt textField (bfs MsgSshPubKey) (Just maybeSshPubKey)
<*> fileAFormOpt (bfs MsgAvatar)

View File

@ -8,7 +8,7 @@
<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}>
<form method=post action=@{YourAccountR}#form enctype=#{formEnctype} autocomplete="off">
^{formWidget}
<button .btn .btn-primary type="submit">
_{MsgSubmit} <span class="glyphicon glyphicon-upload"></span>