Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default {
- data(){
- return {
- password: {
- old_password: '',
- new_password: '',
- repeat_password: ''
- }
- }
- },
- methods: {
- changePassword() {
- axios.post('api/change_password', this.password).then( response=> {
- this.password = {
- old_password: '',
- new_password: '',
- repeat_password: ''
- };
- console.log(response.data.message);
- });
- }
- }
- }
- public function update(Request $request)
- {
- $get_user = Auth::user();
- $user = User::find($get_user->id);
- $current_password = $get_user->password;
- if (Hash::check($request->input('old_password'), $get_user->password) && ($request->input('new_password') == $request->input('repeat_password'))) {
- $user->update([
- 'password' => Hash::make($request->input('new_password'))
- ]);
- return response()->json([
- 'message' => 'Password updated'
- ]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement