/** * Post porfile password * @param type $id * @param type ProfilePassword $request * @return type Response */ public function postProfilePassword(ProfilePassword $request) { $user = Auth::user(); //echo $user->password; if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { $user->password = Hash::make($request->input('new_password')); $user->save(); return redirect()->back()->with('success2', 'Password Updated sucessfully'); } else { return redirect()->back()->with('fails2', 'Password was not Updated. Incorrect old password'); } }
/** * Post profile password * @param type int $id * @param type ProfilePassword $request * @return type Redirect */ public function postProfilePassword($id, ProfilePassword $request) { // get authenticated user $user = Auth::user(); // checking if the old password matches the new password if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { $user->password = Hash::make($request->input('new_password')); try { $user->save(); return redirect('profile-edit')->with('success1', 'Password Updated sucessfully'); } catch (Exception $e) { return redirect('profile-edit')->with('fails', $e->errorInfo[2]); } } else { return redirect('profile-edit')->with('fails1', 'Password was not Updated. Incorrect old password'); } }