mirror of
https://github.com/delight-im/PHP-Auth.git
synced 2025-08-04 07:07:25 +02:00
Document 'changePasswordForUserById' from class 'Administration'
This commit is contained in:
12
README.md
12
README.md
@@ -1005,6 +1005,18 @@ catch (\Delight\Auth\EmailNotVerifiedException $e) {
|
||||
#### Changing a user’s password
|
||||
|
||||
```php
|
||||
try {
|
||||
$auth->admin()->changePasswordForUserById($_POST['id'], $_POST['newPassword']);
|
||||
}
|
||||
catch (\Delight\Auth\UnknownIdException $e) {
|
||||
// unknown ID
|
||||
}
|
||||
catch (\Delight\Auth\InvalidPasswordException $e) {
|
||||
// invalid password
|
||||
}
|
||||
|
||||
// or
|
||||
|
||||
try {
|
||||
$auth->admin()->changePasswordForUserByUsername($_POST['username'], $_POST['newPassword']);
|
||||
}
|
||||
|
Reference in New Issue
Block a user