diff --git a/config/example-config.php b/config/example-config.php index 7be5509e..21903cdf 100644 --- a/config/example-config.php +++ b/config/example-config.php @@ -124,6 +124,24 @@ $c->admin_email ='calendar-admin@example.com'; */ // $c->list_everyone = false; +/** +* Provide a way of over-riding the default password change UI to render a +* clickable link instead. Usually the UI provides a pair of text boxes to enter +* a new password and confirm password. In some cases where remote authentication +* is being used, the password change process is managed in a more complex way +* and allowing it to be changed locally is not helpful. In this case the UI +* is disabled and an HREF displayed to take the user to the appropriate place for +* facilitating that. +* As well as the Administration UI, this will also affect the Forgotten Password +* UI since it would create a temporary local password. The login HTML rendered by +* libawl-php is over-ridden and replaced by the same HREF as above. +* Users with Administrator privileges will still see the default password change UI. +* Default: unset +*/ +// $c->password_change_override = array( +// 'href' => 'https://my.password/changer', +// 'label' => 'My Password Changer' +// ); /*************************************************************************** * * diff --git a/inc/DAViCalSession.php b/inc/DAViCalSession.php index 5c7ab6ea..cb9cca15 100644 --- a/inc/DAViCalSession.php +++ b/inc/DAViCalSession.php @@ -130,6 +130,59 @@ class DAViCalSession extends Session } + /** + * Renders some HTML for a basic login panel + * + * @return string The HTML to display a login panel. + */ + function RenderLoginPanel() { + global $c; + $action_target = htmlspecialchars(preg_replace('/\?logout.*$/','',$_SERVER['REQUEST_URI'])); + dbg_error_log( "Login", " RenderLoginPanel: action_target='%s'", $action_target ); + $userprompt = translate("User Name"); + $pwprompt = translate("Password"); + $gobutton = htmlspecialchars(translate("GO!")); + $gotitle = htmlspecialchars(translate("Enter your username and password then click here to log in.")); + $temppwprompt = translate("If you have forgotten your password then"); + $temppwbutton = htmlspecialchars(translate("Help! I've forgotten my password!")); + if (isset($c->password_change_override) ) { + $temppw_html = '' . $c->password_change_override['label'] . ''; + } else { + $temppwtitle = htmlspecialchars(translate("Enter a username, if you know it, and click here, to be e-mailed a temporary password.")); + $temppw_html = ''; + } + $html = << +
+ + + + + + + + + + + + + +
$userprompt: +
$pwprompt: + +
  + +
+

+$temppwprompt: $temppw_html +

+
+ + +EOTEXT; + return $html; + } + /** * Checks that this user is logged in, and presents a login screen if they aren't. diff --git a/inc/ui/principal-edit.php b/inc/ui/principal-edit.php index 72ca1fd0..c8f5977c 100644 --- a/inc/ui/principal-edit.php +++ b/inc/ui/principal-edit.php @@ -327,12 +327,23 @@ function principal_editor() { } $admin_row_entry = ''; + $default_passwd_row_entry = ' ' . $prompt_password_1 . ': ##newpass1.password.$pwstars## '; + $default_passwd_row_entry .= ' ' . $prompt_password_2 . ': ##newpass2.password.$pwstars## '; $delete_principal_button = ''; if ( $session->AllowedTo('Admin') ) { - $admin_row_entry = ' '.$prompt_admin.':##is_admin.checkbox## '; - $admin_row_entry .= ' '.$prompt_active.':##user_active.checkbox## '; + $passwd_row_entry = $default_passwd_row_entry; + $admin_row_entry = ' ' . $prompt_admin . ':##is_admin.checkbox## '; + $admin_row_entry .= ' ' . $prompt_active . ':##user_active.checkbox## '; if ( isset($id) ) - $delete_principal_button = '' . translate("Delete Principal") . ''; + $delete_principal_button = '' . translate("Delete Principal") . ''; + } else { + if ( isset($c->password_change_override) ) { + $passwd_row_entry = ' ' . $prompt_password_1 . ':'; + $passwd_row_entry .= ''; + $passwd_row_entry .= $c->password_change_override['label'] . ' '; + } else { + $passwd_row_entry = $default_passwd_row_entry; + } } $email_unique = ''; @@ -401,8 +412,7 @@ label.privilege { $prompt_username: ##xxxxusername.input.50## - $prompt_password_1: ##newpass1.password.$pwstars## - $prompt_password_2: ##newpass2.password.$pwstars## + $passwd_row_entry $prompt_fullname: ##fullname.input.50## $prompt_email: ##email.input.50##$email_unique $prompt_locale: ##locale.select##