From d9cbb0f0a62bba345ed26ac68364bb441f41d35d Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Fri, 12 May 2006 09:40:56 +0000 Subject: Bug 300410: Bugzilla::Auth needs to be restructured to not require a BEGIN block Patch By Max Kanat-Alexander r=LpSolit, a=myk --- .../en/default/account/auth/ldap-error.html.tmpl | 52 ---------------------- .../en/default/account/auth/login-small.html.tmpl | 2 +- template/en/default/account/auth/login.html.tmpl | 14 +----- .../en/default/account/prefs/account.html.tmpl | 29 ++++++------ template/en/default/admin/sudo.html.tmpl | 2 +- template/en/default/global/code-error.html.tmpl | 52 +++++++++++++++++++--- template/en/default/global/useful-links.html.tmpl | 9 ++-- template/en/default/global/user-error.html.tmpl | 4 -- template/en/default/index.html.tmpl | 6 +-- template/en/default/sidebar.xul.tmpl | 2 +- 10 files changed, 74 insertions(+), 98 deletions(-) delete mode 100644 template/en/default/account/auth/ldap-error.html.tmpl (limited to 'template') 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 - #%] - -[%# 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: [% info.errstr FILTER html %]. - [% 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: [% auth_err_tag FILTER html %] - -[% 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 %] [ Forgot my Password ] [% END %] 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 %]

@@ -111,10 +108,7 @@

[% END %] - [%# For now, password change requests only apply to the DB - # verification method #%] - - [% IF has_db != 0 %] + [% IF user.authorizer.can_change_password %]
@@ -126,10 +120,6 @@ - [% END %] -
-[% 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 @@
+ [% IF user.authorizer.can_change_password %] + + New password: + + + + - - New password: - - - - - - - Re-enter new password: - - - - + + Re-enter new password: + + + + + [% END %] Your real name (optional, but encouraged): @@ -64,7 +65,7 @@ - [% IF Param('allowemailchange') %] + [% IF user.authorizer.can_change_email && Param('allowemailchange') %] [% IF login_change_date %] [% IF new_login_name %] 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.

- [% IF user.get_flag("can_logout") %] + [% IF user.authorizer.can_login %]

Finally, enter your [% terms.Bugzilla %] password: [% addr FILTER html %]) + 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: + \ ( ) & < > , ; : " [ ], or any whitespace. [% 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 [% field FILTER html %] and [% type FILTER html %] together. @@ -247,6 +272,19 @@ given. [% END %] + [% ELSIF error == "ldap_bind_failed" %] + Failed to bind to the LDAP server. The error message was: + [% errstr FILTER html %] + + [% 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 [% server FILTER html %]. + + [% 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 %] [% ' | Sanity check' IF user.groups.tweakparams %] - [% IF user.get_flag('can_logout') %] + [% IF user.authorizer.can_logout %] | Log out  [% ELSE %] | Logged in as  @@ -70,10 +70,13 @@ [% user.login FILTER html %] [% END %] [% ELSE %] - [% IF Param('createemailregexp') %] + [% IF Param('createemailregexp') + && user.authorizer.user_can_create_account %] | New Account [% END %] - | Log In + [% IF user.authorizer.can_login %] + | Log In + [% END %] [% END %] 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() {

  • Summary reports and charts
  • [% IF user.id %]
  • Change password or user preferences
  • - [% IF user.get_flag('can_logout') %] + [% IF user.authorizer.can_logout %]
  • Log out [% user.login FILTER html %]
  • [% 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 %]
  • Open a new [% terms.Bugzilla %] account
  • [% 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 %] [%- END %] - [%- IF user.get_flag('can_logout') %] + [%- IF user.authorizer.can_logout %] [%- END %] -- cgit v1.2.3-24-g4f1b