1
0
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:
Marco
2017-09-26 22:23:28 +02:00
parent ea91d8c92e
commit f8f44a0286

View File

@@ -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