Skip to content

Commit

Permalink
Document optionallyChangePassword method
Browse files Browse the repository at this point in the history
  • Loading branch information
DivineOmega committed Oct 31, 2018
1 parent d3a24cb commit ede0ced
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ the following scenerios.
* Register
* Change password, with old password
* Change password, without old password
* Optionally change password, with old password
* Optionally change password, without old password
* Login



See the code below for example usage syntax.

```php
Expand All @@ -53,6 +57,18 @@ $this->validate($request, [
'password' => PasswordRules::changePassword($request->email, $request->old_password),
]);

// Optionally change password, without old password
$this->validate($request, [
'old_password' => 'required',
'password' => PasswordRules::optionallyChangePassword($request->email),
]);

// Optionally change password, with old password
$this->validate($request, [
'old_password' => 'required',
'password' => PasswordRules::optionallyChangePassword($request->email, $request->old_password),
]);

// Change password, without old password
$this->validate($request, [
'old_password' => 'required',
Expand All @@ -65,3 +81,7 @@ $this->validate($request, [
'password' => PasswordRules::login(),
]);
```

The `optionallyChangePassword` method supplies validation rules that are
appropriate for forms in which the password can be optionally changed if
filled in.

0 comments on commit ede0ced

Please sign in to comment.