Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // to process the above form
- public function updateUserPassword(Requests\ChangePasswordRequest $request)
- {
- $user = User::find(Auth::user()->id);
- // make sure old password is genuine
- $genuine = Hash::check($request->old_password, $user->password);
- if ($genuine == false) {
- return Redirect::back()->withInput()->with('errorMessage', trans('notification.incorrectOldPassword'));
- }
- $user->password = bcrypt($request->password);
- try {
- $user->save();
- return Redirect::to('/user/profile')->with('successMessage', trans('notification.changePasswordSuccess'));
- } catch (\Exception $e) {
- return Redirect::back()->withInput()->with('errorMessage', trans('notification.changePasswordFail'));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement