Skip to content

Commit

Permalink
Use new Password::defaults() feature.
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed May 19, 2021
1 parent e2478cd commit 57af9f2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion auth-backend/AuthenticatesUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\Rules;
use Illuminate\Validation\ValidationException;

trait AuthenticatesUsers
Expand Down Expand Up @@ -67,7 +68,7 @@ protected function validateLogin(Request $request)
{
$request->validate([
$this->username() => 'required|string',
'password' => 'required|string',
'password' => Rules\Password::required(),
]);
}

Expand Down
5 changes: 3 additions & 2 deletions auth-backend/ResetsPasswords.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Str;
use Illuminate\Validation\Rules;
use Illuminate\Validation\ValidationException;

trait ResetsPasswords
Expand All @@ -26,7 +27,7 @@ trait ResetsPasswords
public function showResetForm(Request $request)
{
$token = $request->route()->parameter('token');

return view('auth.passwords.reset')->with(
['token' => $token, 'email' => $request->email]
);
Expand Down Expand Up @@ -69,7 +70,7 @@ protected function rules()
return [
'token' => 'required',
'email' => 'required|email',
'password' => 'required|confirmed|min:8',
'password' => ['required', 'confirmed', Rules\Password::defaults()],
];
}

Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
],
"require": {
"php": "^7.3|^8.0",
"illuminate/console": "^8.0",
"illuminate/filesystem": "^8.0",
"illuminate/support": "^8.0"
"illuminate/console": "^8.42",
"illuminate/filesystem": "^8.42",
"illuminate/support": "^8.42",
"illuminate/validation": "^8.42"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit 57af9f2

Please sign in to comment.