summaryrefslogtreecommitdiffstats
path: root/template
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2006-05-12 11:40:56 +0200
committermkanat%bugzilla.org <>2006-05-12 11:40:56 +0200
commitd9cbb0f0a62bba345ed26ac68364bb441f41d35d (patch)
tree415d30523fb728a3192970a6d2b168b095f260dc /template
parentd7447bf95827d7e9da681d496a192fffbc2810a4 (diff)
downloadbugzilla-d9cbb0f0a62bba345ed26ac68364bb441f41d35d.tar.gz
bugzilla-d9cbb0f0a62bba345ed26ac68364bb441f41d35d.tar.xz
Bug 300410: Bugzilla::Auth needs to be restructured to not require a BEGIN block
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=myk
Diffstat (limited to 'template')
-rw-r--r--template/en/default/account/auth/ldap-error.html.tmpl52
-rw-r--r--template/en/default/account/auth/login-small.html.tmpl2
-rw-r--r--template/en/default/account/auth/login.html.tmpl14
-rw-r--r--template/en/default/account/prefs/account.html.tmpl29
-rw-r--r--template/en/default/admin/sudo.html.tmpl2
-rw-r--r--template/en/default/global/code-error.html.tmpl52
-rw-r--r--template/en/default/global/useful-links.html.tmpl9
-rw-r--r--template/en/default/global/user-error.html.tmpl4
-rw-r--r--template/en/default/index.html.tmpl6
-rw-r--r--template/en/default/sidebar.xul.tmpl2
10 files changed, 74 insertions, 98 deletions
diff --git a/template/en/default/account/auth/ldap-error.html.tmpl b/template/en/default/account/auth/ldap-error.html.tmpl
deleted file mode 100644
index dba43155b..000000000
--- a/template/en/default/account/auth/ldap-error.html.tmpl
+++ /dev/null
@@ -1,52 +0,0 @@
-[%# 1.0@bugzilla.org %]
-[%# The contents of this file are subject to the Mozilla Public
- # License Version 1.1 (the "License"); you may not use this file
- # except in compliance with the License. You may obtain a copy of
- # the License at http://www.mozilla.org/MPL/
- #
- # Software distributed under the License is distributed on an "AS
- # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- # implied. See the License for the specific language governing
- # rights and limitations under the License.
- #
- # The Original Code is the Bugzilla Bug Tracking System.
- #
- # The Initial Developer of the Original Code is Netscape Communications
- # Corporation. Portions created by Netscape are
- # Copyright (C) 1998 Netscape Communications Corporation. All
- # Rights Reserved.
- #
- # Contributor(s): Bradley Baetz <bbaetz@acm.org>
- #%]
-
-[%# INTERFACE:
- # auth_err_tag: string. The tag for the error
- # info: hash. Additional variables which may be used when printing details
- # of the error.
- #%]
-
-[% PROCESS global/variables.none.tmpl %]
-
-[% admindocslinks = {'extraconfig.html#bzldap' => 'Setting up LDAP authentication'} %]
-
-[% SWITCH auth_err_tag %]
- [% CASE "cannot_retreive_attr" %]
- The specified LDAP attribute [% info.attr FILTER html %] was not found.
-
- [% CASE "connect_failed" %]
- An error occurred while trying to connect to the LDAP server.
- [% IF info.errstr %]
- The error from the server was: <tt>[% info.errstr FILTER html %]</tt>.
- [% END %]
-
- [% CASE "no_userid" %]
- [% terms.Bugzilla %] created a new account for you, but then could not find the
- new userid.
-
- [% CASE "server_not_defined" %]
- The LDAP server for authentication has not been defined.
-
- [% CASE %]
- Unhandled authentication error: <tt>[% auth_err_tag FILTER html %]</tt>
-
-[% END %]
diff --git a/template/en/default/account/auth/login-small.html.tmpl b/template/en/default/account/auth/login-small.html.tmpl
index a18ee70a2..ca500a8aa 100644
--- a/template/en/default/account/auth/login-small.html.tmpl
+++ b/template/en/default/account/auth/login-small.html.tmpl
@@ -79,7 +79,7 @@
[%# For now, password change requests only apply to the DB
# verification method #%]
- [% IF has_db != 0 %]
+ [% IF user.authorizer.can_change_password %]
<td>[ <a href="index.cgi?GoAheadAndLogIn=1#forgot">Forgot my Password</a> ]</td>
[% END %]
</tr>
diff --git a/template/en/default/account/auth/login.html.tmpl b/template/en/default/account/auth/login.html.tmpl
index d2c4950e4..adbae970a 100644
--- a/template/en/default/account/auth/login.html.tmpl
+++ b/template/en/default/account/auth/login.html.tmpl
@@ -22,7 +22,6 @@
[%# INTERFACE:
# target: string. URL to go to after login.
- # has_db: true if DB is one of the available authentication mechanisms
#%]
[% PROCESS global/variables.none.tmpl %]
@@ -100,9 +99,7 @@
# their password, assuming that our auth method allows that.
#%]
-[% IF caneditaccount %]
-
- [% IF Param("createemailregexp") %]
+ [% IF Param("createemailregexp") && user.authorizer.user_can_create_account %]
<hr>
<p>
@@ -111,10 +108,7 @@
</p>
[% END %]
- [%# For now, password change requests only apply to the DB
- # verification method #%]
-
- [% IF has_db != 0 %]
+ [% IF user.authorizer.can_change_password %]
<hr>
<a name="forgot"></a>
@@ -126,10 +120,6 @@
<input size="35" name="loginname">
<input type="submit" value="Submit Request">
</form>
-
[% END %]
- <hr>
-[% END %]
-
[% PROCESS global/footer.html.tmpl %]
diff --git a/template/en/default/account/prefs/account.html.tmpl b/template/en/default/account/prefs/account.html.tmpl
index dc936d43c..e914ecf6c 100644
--- a/template/en/default/account/prefs/account.html.tmpl
+++ b/template/en/default/account/prefs/account.html.tmpl
@@ -42,20 +42,21 @@
<tr>
<td colspan="2"><hr></td>
</tr>
+ [% IF user.authorizer.can_change_password %]
+ <tr>
+ <th align="right">New password:</th>
+ <td>
+ <input type="password" name="new_password1">
+ </td>
+ </tr>
- <tr>
- <th align="right">New password:</th>
- <td>
- <input type="password" name="new_password1">
- </td>
- </tr>
-
- <tr>
- <th align="right">Re-enter new password:</th>
- <td>
- <input type="password" name="new_password2">
- </td>
- </tr>
+ <tr>
+ <th align="right">Re-enter new password:</th>
+ <td>
+ <input type="password" name="new_password2">
+ </td>
+ </tr>
+ [% END %]
<tr>
<th align="right">Your real name (optional, but encouraged):</th>
@@ -64,7 +65,7 @@
</td>
</tr>
- [% IF Param('allowemailchange') %]
+ [% IF user.authorizer.can_change_email && Param('allowemailchange') %]
[% IF login_change_date %]
[% IF new_login_name %]
<tr>
diff --git a/template/en/default/admin/sudo.html.tmpl b/template/en/default/admin/sudo.html.tmpl
index 4e781796c..b35390545 100644
--- a/template/en/default/admin/sudo.html.tmpl
+++ b/template/en/default/admin/sudo.html.tmpl
@@ -76,7 +76,7 @@
are impersonating them.
</p>
- [% IF user.get_flag("can_logout") %]
+ [% IF user.authorizer.can_login %]
<p>
Finally, enter your [% terms.Bugzilla %] password:
<input type="hidden" name="Bugzilla_login" value="
diff --git a/template/en/default/global/code-error.html.tmpl b/template/en/default/global/code-error.html.tmpl
index d9220f27b..1c15255af 100644
--- a/template/en/default/global/code-error.html.tmpl
+++ b/template/en/default/global/code-error.html.tmpl
@@ -48,15 +48,23 @@
Attachment #[% attach_id FILTER html %] ([% description FILTER html %])
is already obsolete.
- [% ELSIF error == "auth_err" %]
- [% title = "Internal Authentication Error" %]
- [%# Authentication errors are in a template depending on the auth method,
- for pluggability.
- #%]
- [% INCLUDE "account/auth/$authmethod-error.html.tmpl" %]
+ [% ELSIF error == "auth_invalid_email" %]
+ [% title = "Invalid Email Address" %]
+ We received an email address (<b>[% addr FILTER html %]</b>)
+ that didn't pass our syntax checking for a legal email address,
+ when trying to create or update your account.
+ [% IF default %]
+ A legal address must contain exactly one '@',
+ and at least one '.' after the @.
+ [% ELSE %]
+ [%+ Param('emailregexpdesc') %]
+ [% END %]
+ It must also not contain any of these special characters:
+ <tt>\ ( ) &amp; &lt; &gt; , ; : &quot; [ ]</tt>, or any whitespace.</tt>
[% ELSIF error == "authres_unhandled" %]
- An authorization handler return value was not handled by the login code.
+ The result value of [% value FILTER html %] was not handled by
+ the login code.
[% ELSIF error == "bad_page_cgi_id" %]
[% title = "Invalid Page ID" %]
@@ -103,10 +111,27 @@
[% ELSIF error == "cookies_need_value" %]
Every cookie must have a value.
+ [% ELSIF error == "env_no_email" %]
+ [% terms.Bugzilla %] did not receive an email address from the
+ environment.
+ [% IF Param("auth_env_email") %]
+ This means that the '[% Param("auth_env_email") FILTER html %]'
+ environment variable was empty or did not exist.
+ [% ELSE %]
+ You need to set the "auth_env_email" environment variable to
+ the name of the environment variable that will contain the
+ user's email address.
+ [% END %]
+
[% ELSIF error == "extension_invalid" %]
An error occured processing hook [% name FILTER html %] in
extension [% extension FILTER html %].
+ [% ELSIF error == "extern_id_conflict" %]
+ The external ID '[% extern_id FILTER html %]' already exists
+ in the database for '[% username FILTER html %]', but your
+ account source says that '[% extern_user FILTER html %]' has that ID.
+
[% ELSIF error == "field_type_mismatch" %]
Cannot seem to handle <code>[% field FILTER html %]</code>
and <code>[% type FILTER html %]</code> together.
@@ -247,6 +272,19 @@
given.
[% END %]
+ [% ELSIF error == "ldap_bind_failed" %]
+ Failed to bind to the LDAP server. The error message was:
+ <code>[% errstr FILTER html %]</code>
+
+ [% ELSIF error == "ldap_cannot_retreive_attr" %]
+ The specified LDAP attribute [% attr FILTER html %] was not found.
+
+ [% ELSIF error == "ldap_connect_failed" %]
+ Could not connect to the LDAP server <code>[% server FILTER html %]</code>.
+
+ [% ELSIF error == "ldap_server_not_defined" %]
+ The LDAP server for authentication has not been defined.
+
[% ELSIF error == "missing_bug_id" %]
No [% terms.bug %] ID was given.
diff --git a/template/en/default/global/useful-links.html.tmpl b/template/en/default/global/useful-links.html.tmpl
index b2e598163..3ac44d62a 100644
--- a/template/en/default/global/useful-links.html.tmpl
+++ b/template/en/default/global/useful-links.html.tmpl
@@ -57,7 +57,7 @@
[% IF user.login %]
[% ' | <a href="sanitycheck.cgi">Sanity&nbsp;check</a>'
IF user.groups.tweakparams %]
- [% IF user.get_flag('can_logout') %]
+ [% IF user.authorizer.can_logout %]
| <a href="relogin.cgi">Log&nbsp;out</a>&nbsp;
[% ELSE %]
| Logged&nbsp;in&nbsp;as&nbsp;
@@ -70,10 +70,13 @@
[% user.login FILTER html %]
[% END %]
[% ELSE %]
- [% IF Param('createemailregexp') %]
+ [% IF Param('createemailregexp')
+ && user.authorizer.user_can_create_account %]
| <a href="createaccount.cgi">New&nbsp;Account</a>
[% END %]
- | <a href="index.cgi?GoAheadAndLogIn=1">Log&nbsp;In</a>
+ [% IF user.authorizer.can_login %]
+ | <a href="index.cgi?GoAheadAndLogIn=1">Log&nbsp;In</a>
+ [% END %]
[% END %]
</div>
</div>
diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl
index e12bdf032..ee7f6c17d 100644
--- a/template/en/default/global/user-error.html.tmpl
+++ b/template/en/default/global/user-error.html.tmpl
@@ -1339,10 +1339,6 @@
[% title = "Wrong Token" %]
That token cannot be used to change your password.
- [% ELSIF error == "extern_id_conflict" %]
- [% title = "Extern ID Conflict" %]
- Someone with a different external ID has that address.
-
[% ELSIF error == "wrong_token_for_confirming_email_change" %]
[% title = "Wrong Token" %]
That token cannot be used to change your email address.
diff --git a/template/en/default/index.html.tmpl b/template/en/default/index.html.tmpl
index a19334c30..c8474494d 100644
--- a/template/en/default/index.html.tmpl
+++ b/template/en/default/index.html.tmpl
@@ -69,12 +69,12 @@ function addSidebar() {
<li id="report"><a href="report.cgi">Summary reports and charts</a></li>
[% IF user.id %]
<li id="userprefs"><a href="userprefs.cgi">Change password or user preferences</a></li>
- [% IF user.get_flag('can_logout') %]
+ [% IF user.authorizer.can_logout %]
<li id="logout"><a href="relogin.cgi">Log out [% user.login FILTER html %]</a></li>
[% END %]
-[% ELSE %]
+[% ELSIF user.authorizer.can_login %]
[% PROCESS "account/auth/login-small.html.tmpl" %]
- [% IF Param('createemailregexp') %]
+ [% IF Param('createemailregexp') && user.authorizer.user_can_create_account %]
<li id="account"><a href="createaccount.cgi">Open a new [% terms.Bugzilla %] account</a></li>
[% END %]
[% END %]
diff --git a/template/en/default/sidebar.xul.tmpl b/template/en/default/sidebar.xul.tmpl
index 18f8e7573..9ad50e07b 100644
--- a/template/en/default/sidebar.xul.tmpl
+++ b/template/en/default/sidebar.xul.tmpl
@@ -97,7 +97,7 @@ function normal_keypress_handler( aEvent ) {
[%- IF user.groups.tweakparams %]
<text class="text-link" onclick="load_relative_url('sanitycheck.cgi')" value="sanity check"/>
[%- END %]
- [%- IF user.get_flag('can_logout') %]
+ [%- IF user.authorizer.can_logout %]
<text class="text-link" onclick="load_relative_url('relogin.cgi')" value="log out [% user.login FILTER html %]"/>
[%- END %]
<separator class="thin"/>