Skip to content

Commit 50ce3b8

Browse files
committed
Improve doc
1 parent 421b078 commit 50ce3b8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

docs/guide/authentication.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,11 @@ The trat will take care of the form, validation and rate-limiting. Note that:
319319

320320
You can configure the behavior of the command with the following methods (should be called in your `buildCommandConfig()` method):
321321

322-
- `configureConfirmPassword(?bool $confirm = true)`: enable password confirmation (false by default)
323-
- `configurePasswordRule(Password $rule)`: change the default password validation rule (default: `Password::min(8)`)
324-
- `configureValidateCurrentPassword(?bool $validate = true)`: if true, a `password` field that uses Laravel’s `current_password` rule, which compares against the currently authenticated user’s stored password, is added. Make sure your `User` model stores a hashed password as usual. (true by default)
322+
- `configureConfirmPassword(?bool $confirm = true)`: (false by default) enable password confirmation.
323+
- `configurePasswordRule(Password $rule)`: (default: `Password::min(8)`) change the default password validation rule.
324+
- `configureValidateCurrentPassword(?bool $validate = true)`: (true by default) if true, a `password` field that uses Laravel’s `current_password` rule (which compares against the currently authenticated user’s stored password) is added. Make sure you use Eloquent, and that your `User` model stores a hashed password as usual.
325325

326-
### Example
326+
### Full example
327327

328328
```php
329329
use Code16\Sharp\Auth\Password\Command\IsChangePasswordCommandTrait;
@@ -359,6 +359,10 @@ class ChangePasswordCommand extends SingleInstanceCommand
359359
}
360360
```
361361

362+
::: info
363+
In this example we chose to create a `SingleInstanceCommand`, since it’s a common use-case to attach such a command to a "Profile" single Show Page that could be [placed in the user menu](building-menu.md#add-links-in-the-user-profile-menu), but you can decide to create an `EntityCommand` or even an `InstanceCommand` instead.
364+
:::
365+
362366
## User impersonation (dev only)
363367

364368
At the development stage, it can be useful to replace the login form by a user impersonation. Sharp allows doing that out of the box:

0 commit comments

Comments
 (0)