mirror of
https://github.com/delight-im/PHP-Auth.git
synced 2025-07-11 19:46:22 +02:00
Document 'changePasswordForUserByUsername' from 'Administration'
This commit is contained in:
18
README.md
18
README.md
@ -82,6 +82,7 @@ Migrating from an earlier version of this project? See our [upgrade guide](Migra
|
|||||||
* [Taking roles away from users](#taking-roles-away-from-users)
|
* [Taking roles away from users](#taking-roles-away-from-users)
|
||||||
* [Checking roles](#checking-roles-1)
|
* [Checking roles](#checking-roles-1)
|
||||||
* [Impersonating users (logging in as user)](#impersonating-users-logging-in-as-user)
|
* [Impersonating users (logging in as user)](#impersonating-users-logging-in-as-user)
|
||||||
|
* [Changing a user’s password](#changing-a-users-password)
|
||||||
* [Cookies](#cookies)
|
* [Cookies](#cookies)
|
||||||
* [Renaming the library’s cookies](#renaming-the-librarys-cookies)
|
* [Renaming the library’s cookies](#renaming-the-librarys-cookies)
|
||||||
* [Defining the domain scope for cookies](#defining-the-domain-scope-for-cookies)
|
* [Defining the domain scope for cookies](#defining-the-domain-scope-for-cookies)
|
||||||
@ -1001,6 +1002,23 @@ catch (\Delight\Auth\EmailNotVerifiedException $e) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Changing a user’s password
|
||||||
|
|
||||||
|
```php
|
||||||
|
try {
|
||||||
|
$auth->admin()->changePasswordForUserByUsername($_POST['username'], $_POST['newPassword']);
|
||||||
|
}
|
||||||
|
catch (\Delight\Auth\UnknownUsernameException $e) {
|
||||||
|
// unknown username
|
||||||
|
}
|
||||||
|
catch (\Delight\Auth\AmbiguousUsernameException $e) {
|
||||||
|
// ambiguous username
|
||||||
|
}
|
||||||
|
catch (\Delight\Auth\InvalidPasswordException $e) {
|
||||||
|
// invalid password
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### Cookies
|
### Cookies
|
||||||
|
|
||||||
This library uses two cookies to keep state on the client: The first, whose name you can retrieve using
|
This library uses two cookies to keep state on the client: The first, whose name you can retrieve using
|
||||||
|
Reference in New Issue
Block a user