public function post_reset() { $rules = array('hash64' => 'required', 'password' => 'required|between:8,30', 'repeat_password' => 'required|same:password'); $validation = Validator::make(Input::all(), $rules); if ($validation->fails()) { Input::flash('only', array('hash64', 'hash64')); //Input::flash(); return Redirect::to_action('login@reset')->with_errors($validation); } if (!Input::has('hash64') or is_null($hash64 = Input::get('hash64'))) { return Response::error('404'); } $messages = new \Laravel\Messages(); $messages->add('user_alert', __('user.password_changed')); $messages->add('alert_type', Alert::SUCCESS); if (!User::Change_Password($hash64, Input::get('password'))) { $messages->add('user_alert', __('user.password_not_changed')); $messages->add('alert_type', Alert::ERROR); } return Redirect::to('login')->with_errors($messages); }
} catch (Exception $e) { die($e->getMessage()); } } else { foreach ($validation->errors() as $error) { $displayerror .= $error . '<br>'; } Session::flash('error', $displayerror); } } if (Token::check(Input::get('ChangePassword'))) { $validate = new Validate(); $validation = $validate->check($_POST, array('c_password' => array('required' => true), 'c_vpassword' => array('required' => true, 'matches' => 'c_password'))); if ($validation) { try { $user->Change_Password(Input::get('c_password')); Session::flash('error', 'Password successfully changed'); } catch (Exception $e) { Session::flash('error', $e->getMessage()); } } else { foreach ($validation->errors() as $error) { $displayerror .= $error . '<br>'; } Session::flash('error', $displayerror); } } } } else { Session::flash('error', 'You must be logged in to see the page'); Redirect::to('login.php');