mirror of
https://github.com/PawelSuwinski/moodle-auth_emailotp.git
synced 2026-05-16 21:41:27 +02:00
gen_otp refactoring
This commit is contained in:
20
auth.php
20
auth.php
@@ -205,21 +205,17 @@ class auth_plugin_emailotp extends auth_plugin_base {
|
|||||||
'password' => password_hash($newpassword, PASSWORD_DEFAULT),
|
'password' => password_hash($newpassword, PASSWORD_DEFAULT),
|
||||||
'login_failed_count' => 0,
|
'login_failed_count' => 0,
|
||||||
);
|
);
|
||||||
$a = (object)array(
|
$user = (object)array(
|
||||||
'username' => $username,
|
'id' => -1, // Fake due email_to_user() requirements.
|
||||||
'password' => $newpassword,
|
|
||||||
);
|
|
||||||
return email_to_user(
|
|
||||||
(object)array(
|
|
||||||
'id' => -1,
|
|
||||||
'auth' => $this->authtype,
|
'auth' => $this->authtype,
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
'email' => $username,
|
'email' => $username,
|
||||||
),
|
'password' => $newpassword,
|
||||||
core_user::get_support_user(),
|
);
|
||||||
sprintf('%s: %s', format_string(get_site()->fullname),
|
return email_to_user($user, core_user::get_support_user(),
|
||||||
get_string('otpgeneratedsubj', self::COMPONENT_NAME, $a)),
|
format_string(get_site()->fullname).': '.
|
||||||
get_string('otpgeneratedtext', self::COMPONENT_NAME, $a)
|
get_string('otpgeneratedsubj', self::COMPONENT_NAME, $user),
|
||||||
|
get_string('otpgeneratedtext', self::COMPONENT_NAME, $user)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user