1
0
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:
Marco
2018-03-21 03:24:06 +01:00
parent 550a6d0355
commit 095b8ccc70

View File

@@ -1005,6 +1005,18 @@ catch (\Delight\Auth\EmailNotVerifiedException $e) {
#### Changing a users 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']);
}