mirror of
https://github.com/delight-im/PHP-Auth.git
synced 2025-08-04 15:17:28 +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
|
#### Changing a user’s password
|
||||||
|
|
||||||
```php
|
```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 {
|
try {
|
||||||
$auth->admin()->changePasswordForUserByUsername($_POST['username'], $_POST['newPassword']);
|
$auth->admin()->changePasswordForUserByUsername($_POST['username'], $_POST['newPassword']);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user