summaryrefslogtreecommitdiffstats
path: root/utils/widgets.py
diff options
context:
space:
mode:
authorAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2016-01-12 03:42:21 +0100
committerAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2016-01-12 04:05:49 +0100
commit6687bc8fced2d5bbfec79d5d908f13448dd1e732 (patch)
tree0aec2ccc552429f06edcc02f4160556bdfea3f7d /utils/widgets.py
parent4d81829ff47208ffe19eb3bd2d472a5344844374 (diff)
downloadpadlite-teams-6687bc8fced2d5bbfec79d5d908f13448dd1e732.tar.gz
padlite-teams-6687bc8fced2d5bbfec79d5d908f13448dd1e732.tar.bz2
padlite-teams-6687bc8fced2d5bbfec79d5d908f13448dd1e732.zip
forms: Try to disable autocomplete on forms with password fields
By default browsers (at least chrome is very agressive) try to detect forms with password inputs and try to insert saved passwords (for example from the login page). The default attribute to disable this (autocomplete=off) is ignored sometimes. Therefore we add two hidden input fields, that disable the auto filling at least in chrome.
Diffstat (limited to 'utils/widgets.py')
-rw-r--r--utils/widgets.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/utils/widgets.py b/utils/widgets.py
index 3b65b82..4ce206f 100644
--- a/utils/widgets.py
+++ b/utils/widgets.py
@@ -20,3 +20,15 @@ class TextArea(wtforms.widgets.core.TextArea):
if arg not in kwargs:
kwargs[arg] = self.kwargs[arg]
return super(TextArea, self).__call__(field, **kwargs)
+
+
+class PasswordInput(wtforms.widgets.core.PasswordInput):
+ def __init__(self, hide_value=True, **kwargs):
+ self.kwargs = kwargs
+ super(PasswordInput, self).__init__(hide_value)
+
+ def __call__(self, field, **kwargs):
+ for arg in self.kwargs:
+ if arg not in kwargs:
+ kwargs[arg] = self.kwargs[arg]
+ return super(PasswordInput, self).__call__(field, **kwargs)