"; # content pane
+ } else {
+ print_notice(T_sprintf("Authentication module used for this session (%s) does not provide an ability to set passwords.",
+ $_SESSION["auth_module"]));
+ }
- if ($_SESSION["auth_module"] == "auth_internal") {
+ print "
"; # content pane
- print "
";
+ print "
";
- print_notice("You can create separate passwords for API clients. Using one is required if you enable OTP.");
+ print_notice("You can create separate passwords for API clients. Using one is required if you enable OTP.");
- print "
";
- if ($_SESSION["auth_module"] == "auth_internal") {
+ if ($_SESSION["auth_module"] == "auth_internal") {
- if ($otp_enabled) {
+ if ($otp_enabled) {
- print_warning("One time passwords are currently enabled. Enter your current password below to disable.");
+ print_warning("One time passwords are currently enabled. Enter your current password below to disable.");
- print "";
+ print "";
+ } else {
+
+ print_warning("You will need a compatible Authenticator to use this. Changing your password would automatically disable OTP.");
+ print_notice("You will need to generate app passwords for the API clients if you enable OTP.");
+
+ if (function_exists("imagecreatefromstring")) {
+ print "
" . __("Scan the following code by the Authenticator application or copy the key manually") . "
";
+
+ $csrf_token = $_SESSION["csrf_token"];
+ print "";
} else {
+ print_error("PHP GD functions are required to generate QR codes.");
+ print "
" . __("Use the following OTP key with a compatible Authenticator application") . "
";
+ }
- print_warning("You will need a compatible Authenticator to use this. Changing your password would automatically disable OTP.");
- print_notice("You will need to generate app passwords for the API clients if you enable OTP.");
+ print "";
+ new Ajax.Request('backend.php', {
+ parameters: dojo.objectToQuery(this.getValues()),
+ onComplete: function(transport) {
+ Notify.close();
+ if (transport.responseText.indexOf('ERROR:') == 0) {
+ Notify.error(transport.responseText.replace('ERROR:', ''));
+ } else {
+ window.location.reload();
+ }
+ } });
}
+ ";
+
+ print "";
+
+ print "";
+
+ print "";
+ print "";
+
+ print "";
+
}
- print "
"; # content pane
- print "
"; # tab container
-
+ } else {
+ print_notice("OTP is only available when using auth_internal authentication module.");
}
+ print ""; # content pane
+
+ print ""; # tab container
+
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION,
"hook_prefs_tab_section", "prefPrefsAuth");