]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1179160: The login form should not use type="email" when LDAP has LDAPmailattribu...
authorFrédéric Buclin <LpSolit@gmail.com>
Thu, 6 Aug 2015 14:48:13 +0000 (16:48 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Thu, 6 Aug 2015 14:48:13 +0000 (16:48 +0200)
r=gerv a=dkl

Bugzilla/Template.pm
template/en/default/account/auth/login-small.html.tmpl
template/en/default/account/auth/login.html.tmpl

index 6665029f49f0e17f6e432c925bad954d1b80d1de..ef45cb313dbcf3dbea70fb7d35e8bd6b644ed543 100644 (file)
@@ -1151,6 +1151,17 @@ sub create {
                 return \@optional;
             },
             'default_authorizer' => sub { return Bugzilla::Auth->new() },
+
+            'login_not_email' => sub {
+                my $params = Bugzilla->params;
+                my $cache = Bugzilla->request_cache;
+
+                return $cache->{login_not_email} //=
+                  ($params->{emailsuffix}
+                     || ($params->{user_verify_class} =~ /LDAP/ && $params->{LDAPmailattribute})
+                     || ($params->{user_verify_class} =~ /RADIUS/ && $params->{RADIUS_email_suffix}))
+                  ? 1 : 0;
+            },
         },
     };
     # Use a per-process provider to cache compiled templates in memory across
index 50815124175c9d9099a0878b2052d0331b7993f0..1b7c6b02e31e0d129b42b41a860eea0c32f211f6 100644 (file)
@@ -34,7 +34,7 @@
         id="mini_login[% qs_suffix FILTER html %]">
     <input id="Bugzilla_login[% qs_suffix FILTER html %]" required
            name="Bugzilla_login" class="bz_login"
-      [% IF Param('emailsuffix') %]
+      [% IF login_not_email %]
         placeholder="Login"
       [% ELSE %]
         type="email" placeholder="Email Address"
@@ -64,7 +64,7 @@
         class="mini_forgot bz_default_hidden">
     <label for="login[% qs_suffix FILTER html %]">Login:</label>
     <input name="loginname" size="20" id="login[% qs_suffix FILTER html %]" required
-      [% IF Param('emailsuffix') %]
+      [% IF login_not_email %]
         placeholder="Your Login"
       [% ELSE %]
         type="email" placeholder="Your Email Address"
index 85b3be8fbf8669898e52538bbaface83f5876142..05d177d09d45ca5bf7c71978cae6e736d94f95eb 100644 (file)
@@ -30,7 +30,7 @@
     <tr>
       <th>
         <label for="Bugzilla_login">
-          [% IF Param('emailsuffix') %]
+          [% IF login_not_email %]
             Login:
           [% ELSE %]
             Email&nbsp;Address:
@@ -39,7 +39,7 @@
       </th>
       <td>
         <input id="Bugzilla_login" name="Bugzilla_login"
-               [%- ' type="email"' UNLESS Param('emailsuffix') %] autofocus required>
+               [%- ' type="email"' UNLESS login_not_email %] autofocus required>
         [% Param('emailsuffix') FILTER html %]
       </td>
     </tr>