From 8be73e73a153bd6bac8bb7fa7bab380e581f402d Mon Sep 17 00:00:00 2001 From: Filip Gralinski Date: Sat, 23 Sep 2017 14:51:15 +0200 Subject: [PATCH] trying to switch off autocomplete in account settings (not fully possible) --- Handler/Common.hs | 4 ++-- Handler/YourAccount.hs | 5 ++++- templates/your-account.hamlet | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Handler/Common.hs b/Handler/Common.hs index b85cdc2..4e584eb 100644 --- a/Handler/Common.hs +++ b/Handler/Common.hs @@ -31,9 +31,9 @@ passwordConfirmField = Field _ -> return $ Left "You must enter two values" , fieldView = \idAttr nameAttr otherAttrs _ _ -> [whamlet| - +
re-enter the password - + |] , fieldEnctype = UrlEncoded } diff --git a/Handler/YourAccount.hs b/Handler/YourAccount.hs index 843c506..1e99ce1 100644 --- a/Handler/YourAccount.hs +++ b/Handler/YourAccount.hs @@ -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) diff --git a/templates/your-account.hamlet b/templates/your-account.hamlet index 720ab60..44ed996 100644 --- a/templates/your-account.hamlet +++ b/templates/your-account.hamlet @@ -8,7 +8,7 @@

Please set up your password below so that you could log in when Persona authentication system is shut down. -

+ ^{formWidget}