mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 18:06:51 +02:00
MDL-82379 core_user: Move email change token to user private access key
This commit is contained in:
parent
488da643c6
commit
bef45583cc
4 changed files with 18 additions and 6 deletions
|
@ -199,9 +199,11 @@ if ($userform->is_cancelled()) {
|
|||
// Other users require a confirmation email.
|
||||
if (isset($usernew->email) and $user->email != $usernew->email && !has_capability('moodle/user:update', $systemcontext)) {
|
||||
$a = new stdClass();
|
||||
$emailchangedkey = random_string(20);
|
||||
// Set the key to expire in 10 minutes.
|
||||
$validuntil = time() + 600;
|
||||
$emailchangedkey = create_user_key('core_user/email_change', $user->id, null, null, $validuntil);
|
||||
|
||||
set_user_preference('newemail', $usernew->email, $user->id);
|
||||
set_user_preference('newemailkey', $emailchangedkey, $user->id);
|
||||
set_user_preference('newemailattemptsleft', 3, $user->id);
|
||||
|
||||
$a->newemail = $emailchanged = $usernew->email;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue