You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by ke...@apache.org on 2019/03/08 21:44:55 UTC

[allura] branch master updated: For fields like username/email/password fields, set some autocomplete/capitalize hints

This is an automated email from the ASF dual-hosted git repository.

kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git


The following commit(s) were added to refs/heads/master by this push:
     new e655aaf  For fields like username/email/password fields, set some autocomplete/capitalize hints
e655aaf is described below

commit e655aaf459a662d25107d1dd81bbe44a676c4f0c
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Mon Feb 25 17:18:17 2019 -0500

    For fields like username/email/password fields, set some autocomplete/capitalize hints
    
    mobile safari defaults to autocapitalize to "sentences"
---
 .../allura/ext/admin/templates/project_groups.html |  2 +-
 .../ext/admin/templates/project_install_tool.html  |  3 +-
 Allura/allura/lib/widgets/auth_widgets.py          | 11 ++++---
 Allura/allura/lib/widgets/forms.py                 | 36 +++++++++++++++++++---
 4 files changed, 41 insertions(+), 11 deletions(-)

diff --git a/Allura/allura/ext/admin/templates/project_groups.html b/Allura/allura/ext/admin/templates/project_groups.html
index c203ea7..f468245 100644
--- a/Allura/allura/ext/admin/templates/project_groups.html
+++ b/Allura/allura/ext/admin/templates/project_groups.html
@@ -79,7 +79,7 @@
           </li>
           {% endfor %}
           <li class="new-item">
-            <form class="add_user">
+            <form class="add_user" autocapitalize="none">
               <input type="text" placeholder="type a username">
               <input type="submit" value="Save" class="nofloat">
               <a href="#" class="cancel_link">cancel</a>
diff --git a/Allura/allura/ext/admin/templates/project_install_tool.html b/Allura/allura/ext/admin/templates/project_install_tool.html
index d3f920f..b3e577d 100644
--- a/Allura/allura/ext/admin/templates/project_install_tool.html
+++ b/Allura/allura/ext/admin/templates/project_install_tool.html
@@ -42,7 +42,8 @@
     <div class="grid-13">
         <input id="id_url_input" type="text" name="new.mount_point"
                title="The url for this tool relative to {{ full_url }} " class="new_mount_point validate_input"
-               value="{{ tool.default_mount_point }}" data-regex="{{ mount_point_re }}" maxlength="{{ max_length}}">
+               value="{{ tool.default_mount_point }}" data-regex="{{ mount_point_re }}" maxlength="{{ max_length}}"
+               autocapitalize="none">
         <span id="url_error_message" class="modal-form-error"></span>
         <p><span id="full-url-preview">
             {{ full_url }}<strong style="color:orange"><span id="input-safe-preview"></span></strong>
diff --git a/Allura/allura/lib/widgets/auth_widgets.py b/Allura/allura/lib/widgets/auth_widgets.py
index 4ab869e..b7772ab 100644
--- a/Allura/allura/lib/widgets/auth_widgets.py
+++ b/Allura/allura/lib/widgets/auth_widgets.py
@@ -39,11 +39,13 @@ class LoginForm(ForgeForm):
         fields = [
             ew.TextField(name=g.antispam.enc('username'), label='Username', attrs={
                 'autofocus': 'autofocus',
-                'placeholder': 'Username' if plugin.ThemeProvider.get().use_input_placeholders() else ''
-
+                'placeholder': 'Username' if plugin.ThemeProvider.get().use_input_placeholders() else '',
+                'autocomplete': 'username',
+                'autocapitalize': 'none',
             }),
             ew.PasswordField(name=g.antispam.enc('password'), label='Password', attrs={
-                'placeholder': 'Password' if plugin.ThemeProvider.get().use_input_placeholders() else ''
+                'placeholder': 'Password' if plugin.ThemeProvider.get().use_input_placeholders() else '',
+                'autocomplete': 'current-password',
             }),
             ew.Checkbox(
                 name=g.antispam.enc('rememberme'),
@@ -90,7 +92,8 @@ class ForgottenPasswordForm(ForgeForm):
     style = 'wide'
 
     class fields(ew_core.NameList):
-        email = ew.TextField(label='Your e-mail')
+        email = ew.TextField(label='Your e-mail', attrs={'type': 'email', 'required': True, 'autocapitalize': "none"})
+
 
 class DisableAccountForm(ForgeForm):
     submit_text = 'Disable'
diff --git a/Allura/allura/lib/widgets/forms.py b/Allura/allura/lib/widgets/forms.py
index 9c75c51..ac49ce3 100644
--- a/Allura/allura/lib/widgets/forms.py
+++ b/Allura/allura/lib/widgets/forms.py
@@ -151,7 +151,12 @@ class PasswordChangeBase(ForgeForm):
             ew.PasswordField(
                 name='pw',
                 label='New Password',
-                attrs=dict(minlength=asint(tg.config.get('auth.min_password_len', 6)), maxlength=asint(tg.config.get('auth.max_password_len', 30))),
+                attrs=dict(
+                    minlength=asint(tg.config.get('auth.min_password_len', 6)),
+                    maxlength=asint(tg.config.get('auth.max_password_len', 30)),
+                    required=True,
+                    autocomplete='new-password',
+                ),
                 validator=fev.UnicodeString(
                     not_empty=True,
                     min=asint(tg.config.get('auth.min_password_len', 6)),
@@ -159,7 +164,12 @@ class PasswordChangeBase(ForgeForm):
             ew.PasswordField(
                 name='pw2',
                 label='New Password (again)',
-                validator=fev.UnicodeString(not_empty=True)),
+                validator=fev.UnicodeString(not_empty=True),
+                attrs=dict(
+                    required=True,
+                    autocomplete='new-password',
+                )
+            ),
         ]
 
     @ew_core.core.validator
@@ -172,6 +182,7 @@ class PasswordChangeBase(ForgeForm):
     def resources(self):
         yield ew.JSLink('js/password-validator.js')
 
+
 class PasswordChangeForm(PasswordChangeBase):
 
     @property
@@ -180,11 +191,21 @@ class PasswordChangeForm(PasswordChangeBase):
             ew.PasswordField(
                 name='oldpw',
                 label='Old Password',
-                validator=fev.UnicodeString(not_empty=True)),
+                validator=fev.UnicodeString(not_empty=True),
+                attrs=dict(
+                    required=True,
+                    autocomplete='current-password',
+                ),
+            ),
             ew.PasswordField(
                 name='pw',
                 label='New Password',
-                attrs=dict(minlength=asint(tg.config.get('auth.min_password_len', 6)), maxlength=asint(tg.config.get('auth.max_password_len', 30))),
+                attrs=dict(
+                    minlength=asint(tg.config.get('auth.min_password_len', 6)),
+                    maxlength=asint(tg.config.get('auth.max_password_len', 30)),
+                    required=True,
+                    autocomplete='new-password',
+                ),
                 validator=fev.UnicodeString(
                     not_empty=True,
                     min=asint(tg.config.get('auth.min_password_len', 6)),
@@ -192,7 +213,12 @@ class PasswordChangeForm(PasswordChangeBase):
             ew.PasswordField(
                 name='pw2',
                 label='New Password (again)',
-                validator=fev.UnicodeString(not_empty=True)),
+                validator=fev.UnicodeString(not_empty=True),
+                attrs=dict(
+                    required=True,
+                    autocomplete='new-password',
+                ),
+            ),
             ew.HiddenField(name='return_to'),
         ]