This repository was archived by the owner on Mar 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ class User extends Component
1919 protected function rules ()
2020 {
2121 return [
22- 'user.name ' => 'required|string ' ,
23- 'user.email ' => ['required ' , 'email ' , 'not_in: ' . $ this ->user ->id ],
22+ 'user.name ' => 'required|string ' ,
23+ 'user.email ' => ['required ' , 'email ' , 'not_in: ' . $ this ->user ->id ],
2424 ];
2525 }
2626
@@ -54,16 +54,19 @@ public function updateUser()
5454 public function updatePassword ()
5555 {
5656 $ validatedData = $ this ->validate ([
57- 'credentials.password ' => 'required|confirmed ' ,
58- 'credentials.password_confirmation ' => 'required '
59- ]);
57+ 'credentials.password ' => 'required|confirmed ' ,
58+ 'credentials.password_confirmation ' => 'required '
59+ ] + $ this ->rules ());
60+
6061 $ this ->user ->forceFill ([
6162 'password ' => \Illuminate \Support \Facades \Hash::make ($ this ->credentials ['password ' ]),
6263 ])->save ();
63- Auth::login ($ this ->user );
6464
65- }
65+ //if edited user is same as logged in user
66+ if ($ this ->user ->id == auth ()->user ()->id )
67+ Auth::login ($ this ->user );
6668
69+ }
6770
6871
6972}
You can’t perform that action at this time.
0 commit comments