mirror of
https://github.com/delight-im/PHP-Auth.git
synced 2025-08-02 22:27:30 +02:00
Show that users are to reconfirm their password for email changes
This commit is contained in:
13
README.md
13
README.md
@@ -336,11 +336,16 @@ If a user is currently logged in, they may change their email address.
|
||||
|
||||
```php
|
||||
try {
|
||||
$auth->changeEmail($_POST['newEmail'], function ($selector, $token) {
|
||||
// send `$selector` and `$token` to the user (e.g. via email)
|
||||
});
|
||||
if ($auth->reconfirmPassword($_POST['password'])) {
|
||||
$auth->changeEmail($_POST['newEmail'], function ($selector, $token) {
|
||||
// send `$selector` and `$token` to the user (e.g. via email)
|
||||
});
|
||||
|
||||
// the change will take effect as soon as the email address has been confirmed
|
||||
// the change will take effect as soon as the email address has been confirmed
|
||||
}
|
||||
else {
|
||||
// we can't say if the user is who they claim to be
|
||||
}
|
||||
}
|
||||
catch (\Delight\Auth\InvalidEmailException $e) {
|
||||
// invalid email address
|
||||
|
Reference in New Issue
Block a user