summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2015-08-06 16:48:13 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2015-08-06 16:48:13 +0200
commitbaed5713d175eee3fe2aed9ee3afef916b4641d4 (patch)
tree019396be8893996a1ec6f3ae44af776143c9b9f2
parent5d46fc8d19dfdc7ede2effb14d8067d0d3c6a2d1 (diff)
downloadbugzilla-baed5713d175eee3fe2aed9ee3afef916b4641d4.tar.gz
bugzilla-baed5713d175eee3fe2aed9ee3afef916b4641d4.tar.xz
Bug 1179160: The login form should not use type="email" when LDAP has LDAPmailattribute set
r=gerv a=dkl
-rw-r--r--Bugzilla/Template.pm11
-rw-r--r--template/en/default/account/auth/login-small.html.tmpl4
-rw-r--r--template/en/default/account/auth/login.html.tmpl4
3 files changed, 15 insertions, 4 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index 6665029f4..ef45cb313 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -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
diff --git a/template/en/default/account/auth/login-small.html.tmpl b/template/en/default/account/auth/login-small.html.tmpl
index 508151241..1b7c6b02e 100644
--- a/template/en/default/account/auth/login-small.html.tmpl
+++ b/template/en/default/account/auth/login-small.html.tmpl
@@ -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"
diff --git a/template/en/default/account/auth/login.html.tmpl b/template/en/default/account/auth/login.html.tmpl
index 85b3be8fb..05d177d09 100644
--- a/template/en/default/account/auth/login.html.tmpl
+++ b/template/en/default/account/auth/login.html.tmpl
@@ -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>