Commit a2ae1545 authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 1179160: The login form should not use type="email" when LDAP has LDAPmailattribute set

r=gerv a=dkl
parent ae716b28
...@@ -1158,6 +1158,17 @@ sub create { ...@@ -1158,6 +1158,17 @@ sub create {
return \@optional; return \@optional;
}, },
'default_authorizer' => sub { return Bugzilla::Auth->new() }, '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 # Use a per-process provider to cache compiled templates in memory across
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
id="mini_login[% qs_suffix FILTER html %]"> id="mini_login[% qs_suffix FILTER html %]">
<input id="Bugzilla_login[% qs_suffix FILTER html %]" required <input id="Bugzilla_login[% qs_suffix FILTER html %]" required
name="Bugzilla_login" class="bz_login" name="Bugzilla_login" class="bz_login"
[% IF Param('emailsuffix') %] [% IF login_not_email %]
placeholder="Login" placeholder="Login"
[% ELSE %] [% ELSE %]
type="email" placeholder="Email Address" type="email" placeholder="Email Address"
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
class="mini_forgot bz_default_hidden"> class="mini_forgot bz_default_hidden">
<label for="login[% qs_suffix FILTER html %]">Login:</label> <label for="login[% qs_suffix FILTER html %]">Login:</label>
<input name="loginname" size="20" id="login[% qs_suffix FILTER html %]" required <input name="loginname" size="20" id="login[% qs_suffix FILTER html %]" required
[% IF Param('emailsuffix') %] [% IF login_not_email %]
placeholder="Your Login" placeholder="Your Login"
[% ELSE %] [% ELSE %]
type="email" placeholder="Your Email Address" type="email" placeholder="Your Email Address"
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<tr> <tr>
<th> <th>
<label for="Bugzilla_login"> <label for="Bugzilla_login">
[% IF Param('emailsuffix') %] [% IF login_not_email %]
Login: Login:
[% ELSE %] [% ELSE %]
Your Email Address: Your Email Address:
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
</th> </th>
<td> <td>
<input size="35" id="Bugzilla_login" name="Bugzilla_login" <input size="35" 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 %] [% Param('emailsuffix') FILTER html %]
</td> </td>
</tr> </tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment