Skip to content

Commit af68cb3

Browse files
committed
Hash passwords during user creation and reset
1 parent 81091f7 commit af68cb3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

app/Actions/Fortify/CreateNewUser.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Actions\Fortify;
44

55
use App\Models\User;
6+
use Illuminate\Support\Facades\Hash;
67
use Illuminate\Support\Facades\Validator;
78
use Illuminate\Validation\Rule;
89
use Laravel\Fortify\Contracts\CreatesNewUsers;
@@ -33,7 +34,7 @@ public function create(array $input): User
3334
return User::create([
3435
'name' => $input['name'],
3536
'email' => $input['email'],
36-
'password' => $input['password'],
37+
'password' => Hash::make($input['password']),
3738
]);
3839
}
3940
}

app/Actions/Fortify/ResetUserPassword.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Actions\Fortify;
44

55
use App\Models\User;
6+
use Illuminate\Support\Facades\Hash;
67
use Illuminate\Support\Facades\Validator;
78
use Laravel\Fortify\Contracts\ResetsUserPasswords;
89

@@ -22,7 +23,7 @@ public function reset(User $user, array $input): void
2223
])->validate();
2324

2425
$user->forceFill([
25-
'password' => $input['password'],
26+
'password' => Hash::make($input['password']),
2627
])->save();
2728
}
2829
}

0 commit comments

Comments
 (0)