Skip to content

Commit 177a076

Browse files
Merge pull request #2 from thinkverse/normalize-passwd
Normalize password rules and hashing
2 parents 75c0206 + ae1740a commit 177a076

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/Livewire/User/Profile.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use App\Models\User;
77
use Illuminate\Contracts\View\View;
88
use Illuminate\Support\Facades\Auth;
9+
use Illuminate\Support\Facades\Hash;
10+
use Illuminate\Validation\Rules;
911
use Livewire\Component;
1012

1113
class Profile extends Component
@@ -34,8 +36,8 @@ public function rules(): array
3436
'password' => [
3537
'nullable',
3638
'string',
37-
'min:8',
38-
'confirmed'
39+
'confirmed',
40+
Rules\Password::defaults()
3941
]
4042
];
4143
}
@@ -49,7 +51,7 @@ public function save(): void
4951
{
5052
$this->validate();
5153

52-
$this->user->password = when($this->password !== null, bcrypt($this->password), $this->user->password);
54+
$this->user->password = when($this->password !== null, Hash::make($this->password), $this->user->password);
5355
$this->user->update();
5456

5557
$this->dispatch('updated', name: $this->user->name);

0 commit comments

Comments
 (0)