From a1a2fe40f631737e9d7eeb79a5cc9a8d1ab124bc Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 27 Oct 2023 22:21:30 +0300 Subject: add a separate interface for auth modules w/ change_password() method --- classes/IAuthModule2.php | 4 ++++ classes/Pref_Prefs.php | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 classes/IAuthModule2.php (limited to 'classes') diff --git a/classes/IAuthModule2.php b/classes/IAuthModule2.php new file mode 100644 index 000000000..093ea7e93 --- /dev/null +++ b/classes/IAuthModule2.php @@ -0,0 +1,4 @@ +get_plugin($_SESSION["auth_module"]); - if (method_exists($authenticator, "change_password")) { + if (implements_interface($authenticator, "IAuthModule2")) { + /** @var IAuthModule2 $authenticator */ print format_notice($authenticator->change_password($_SESSION["uid"], $old_pw, $new_pw)); } else { print "ERROR: ".format_error("Function not supported by authentication module."); @@ -325,9 +326,7 @@ class Pref_Prefs extends Handler_Protected { $authenticator = false; } - $otp_enabled = UserHelper::is_otp_enabled($_SESSION["uid"]); - - if ($authenticator && method_exists($authenticator, "change_password")) { + if ($authenticator && implements_interface($authenticator, "IAuthModule2")) { ?> -- cgit v1.2.3