Skip to content

Commit baed571

Browse files
committed
Bug 1179160: The login form should not use type="email" when LDAP has LDAPmailattribute set
r=gerv a=dkl
1 parent 5d46fc8 commit baed571

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

Bugzilla/Template.pm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,17 @@ sub create {
11511151
return \@optional;
11521152
},
11531153
'default_authorizer' => sub { return Bugzilla::Auth->new() },
1154+
1155+
'login_not_email' => sub {
1156+
my $params = Bugzilla->params;
1157+
my $cache = Bugzilla->request_cache;
1158+
1159+
return $cache->{login_not_email} //=
1160+
($params->{emailsuffix}
1161+
|| ($params->{user_verify_class} =~ /LDAP/ && $params->{LDAPmailattribute})
1162+
|| ($params->{user_verify_class} =~ /RADIUS/ && $params->{RADIUS_email_suffix}))
1163+
? 1 : 0;
1164+
},
11541165
},
11551166
};
11561167
# Use a per-process provider to cache compiled templates in memory across

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
id="mini_login[% qs_suffix FILTER html %]">
3535
<input id="Bugzilla_login[% qs_suffix FILTER html %]" required
3636
name="Bugzilla_login" class="bz_login"
37-
[% IF Param('emailsuffix') %]
37+
[% IF login_not_email %]
3838
placeholder="Login"
3939
[% ELSE %]
4040
type="email" placeholder="Email Address"
@@ -64,7 +64,7 @@
6464
class="mini_forgot bz_default_hidden">
6565
<label for="login[% qs_suffix FILTER html %]">Login:</label>
6666
<input name="loginname" size="20" id="login[% qs_suffix FILTER html %]" required
67-
[% IF Param('emailsuffix') %]
67+
[% IF login_not_email %]
6868
placeholder="Your Login"
6969
[% ELSE %]
7070
type="email" placeholder="Your Email Address"

template/en/default/account/auth/login.html.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<tr>
3131
<th>
3232
<label for="Bugzilla_login">
33-
[% IF Param('emailsuffix') %]
33+
[% IF login_not_email %]
3434
Login:
3535
[% ELSE %]
3636
Email&nbsp;Address:
@@ -39,7 +39,7 @@
3939
</th>
4040
<td>
4141
<input id="Bugzilla_login" name="Bugzilla_login"
42-
[%- ' type="email"' UNLESS Param('emailsuffix') %] autofocus required>
42+
[%- ' type="email"' UNLESS login_not_email %] autofocus required>
4343
[% Param('emailsuffix') FILTER html %]
4444
</td>
4545
</tr>

0 commit comments

Comments
 (0)