public function reset() { /* * Todo: password is not reseting */ $input = Input::all(); $rules = ['password' => 'required|min:5', 'repeat' => 'required|min:5']; $validator = Validator::make($input, $rules); if ($validator->fails()) { // get the error messages from the validator $messages = $validator->messages(); // redirect our user back to the form with the errors from the validator return redirect(url(URL::previous()))->withErrors($validator); } else { $reset = Password::where('token', '=', $input['token'])->first(); if ($reset) { try { $reset = $reset->toArray(); $user = User::where('email', '=', $reset['email'])->update(['password' => bcrypt($input['password'])]); $moodle = "UPDATE mdl_user SET " . "password = '******'password']) . "' " . "WHERE email = '" . $reset['email'] . "'"; moodle_db($moodle); return redirect('login'); } catch (Exception $e) { echo $e->message; } } else { echo 'error'; } } }
public function update(Request $request) { $credentials = array('email' => $request->input('email')); return Password::reset($credentials, function ($user, $password) { $user->password = Hash::make($password); $user->save(); return Redirect::to('login')->with('flash', 'Your password has been reset'); }); }
public function destroy($passwordId) { $password = Password::findOrFail($passwordId); $this->authorize('destroy', $password); $password->delete(); return Redirect::to(route('password.index'))->with(['success_message' => 'Deleted.']); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { Password::destroy($id); return Redirect::route('home.index'); }