diff --git a/app/Components/Profile/Manager.php b/app/Components/Profile/Manager.php index b0920a5..8fa168c 100644 --- a/app/Components/Profile/Manager.php +++ b/app/Components/Profile/Manager.php @@ -13,8 +13,6 @@ class Manager extends Component public object $user; public array $roles = []; public array $allRoles = []; - - // Đổi mật khẩu public string $mode = 'view'; // 'view' | 'password' public string $currentPassword = ''; public string $password = ''; @@ -51,17 +49,14 @@ class Manager extends Component // 1. Validate $this->validate(); - // 2. Kiểm tra mật khẩu hiện tại if (! Hash::check($this->currentPassword, $this->user->password)) { $this->addError('currentPassword', 'Mật khẩu hiện tại không đúng.'); return; } - // 3. Cập nhật mật khẩu mới $this->user->password = Hash::make($this->password); $this->user->save(); - // 4. Thông báo & quay về view session()->flash('message', 'Đổi mật khẩu thành công.'); $this->showView(); } @@ -72,7 +67,7 @@ class Manager extends Component 'user' => $this->user, 'roles' => $this->roles, 'allRoles' => collect($this->allRoles), - 'title' => 'Profile của tôi', + 'title' => 'My Profile', ]); } } diff --git a/resources/views/components/profile/manager.blade.php b/resources/views/components/profile/manager.blade.php index 7ff0d32..08407fb 100644 --- a/resources/views/components/profile/manager.blade.php +++ b/resources/views/components/profile/manager.blade.php @@ -7,13 +7,12 @@