SHARE
TWEET

Untitled

a guest May 22nd, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function getReset(Request $request) {
  2.         $validator = Validator::make($request->all(), [
  3.             'oldpass' => 'required|min:6',
  4.             'newpass' => 'required|min:6',
  5.             'uid' => 'required'
  6.         ]);
  7.  
  8.         if ($validator->fails()) {
  9.             return redirect('catalog')->with('statusError', 'Error con el usuario.');
  10.         } else {
  11.             $user = User::findOrFail($request->input('uid'));
  12.             if (Hash::check($request->input('oldpass'), $user->password)) {
  13.                 $user->password = Hash::make($request->input('newpass'));
  14.                 $user->save();
  15.                 return redirect()->back()->with('statusOk', 'ContraseƱa modificada!');
  16.             } else {
  17.                 return redirect()->back()->with('statusError', 'La contraseƱa actual no coincide.');
  18.             }
  19.         }
  20.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top