prefs layout fixes:

1. prevent layout breakage when using an authenticator which doesn't allow changing passwords
2. show explanatory messages when OTP or password changing is not available
3. allow app (API) passwords when using any auth module
master
Andrew Dolgov 5 years ago
parent 06b9d39662
commit 5b6d9cee29

@ -327,7 +327,6 @@ class Pref_Prefs extends Handler_Protected {
print "</form>";
print "</div>"; # content pane
print "<div dojoType='dijit.layout.ContentPane' title=\"".__('Password')."\">";
if ($_SESSION["auth_module"]) {
$authenticator = PluginHost::getInstance()->get_plugin($_SESSION["auth_module"]);
@ -335,6 +334,8 @@ class Pref_Prefs extends Handler_Protected {
$authenticator = false;
}
print "<div dojoType='dijit.layout.ContentPane' title=\"" . __('Password') . "\">";
if ($authenticator && method_exists($authenticator, "change_password")) {
print "<div style='display : none' id='pwd_change_infobox'></div>";
@ -375,17 +376,17 @@ class Pref_Prefs extends Handler_Protected {
}
print "<fieldset>";
print "<label>".__("Old password:")."</label>";
print "<label>" . __("Old password:") . "</label>";
print "<input dojoType='dijit.form.ValidationTextBox' type='password' required='1' name='old_password'>";
print "</fieldset>";
print "<fieldset>";
print "<label>".__("New password:")."</label>";
print "<label>" . __("New password:") . "</label>";
print "<input dojoType='dijit.form.ValidationTextBox' type='password' required='1' name='new_password'>";
print "</fieldset>";
print "<fieldset>";
print "<label>".__("Confirm password:")."</label>";
print "<label>" . __("Confirm password:") . "</label>";
print "<input dojoType='dijit.form.ValidationTextBox' type='password' required='1' name='confirm_password'>";
print "</fieldset>";
@ -394,14 +395,17 @@ class Pref_Prefs extends Handler_Protected {
print "<hr/>";
print "<button dojoType='dijit.form.Button' type='submit' class='alt-primary'>".
__("Change password")."</button>";
print "<button dojoType='dijit.form.Button' type='submit' class='alt-primary'>" .
__("Change password") . "</button>";
print "</form>";
print "</div>"; # content pane
} else {
print_notice(T_sprintf("Authentication module used for this session (<b>%s</b>) does not provide an ability to set passwords.",
$_SESSION["auth_module"]));
}
if ($_SESSION["auth_module"] == "auth_internal") {
print "</div>"; # content pane
print "<div dojoType='dijit.layout.ContentPane' title=\"" . __('App passwords') . "\">";
@ -422,7 +426,6 @@ class Pref_Prefs extends Handler_Protected {
__('Remove selected passwords') . "</button>";
print "</div>"; # content pane
}
print "<div dojoType='dijit.layout.ContentPane' title=\"".__('One time passwords / Authenticator')."\">";
@ -533,12 +536,14 @@ class Pref_Prefs extends Handler_Protected {
print "</form>";
}
} else {
print_notice("OTP is only available when using <b>auth_internal</b> authentication module.");
}
print "</div>"; # content pane
print "</div>"; # tab container
}
print "</div>"; # tab container
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION,
"hook_prefs_tab_section", "prefPrefsAuth");

Loading…
Cancel
Save