public function updatePassword() { $this->checkCurrentUser(); $rules = array('now_password' => 'required', 'password' => 'min:5|confirmed|different:now_password', 'password_confirmation' => 'required_with:password|min:5'); //password update. $nowPassword = Input::get('now_password'); $password = Input::get('password'); $passwordconf = Input::get('password_confirmation'); $validator = Validator::make(Input::only('now_password', 'password', 'password_confirmation'), $rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator); } //var_dump(Hash::make($nowPassword));exit; $currentUserP = User::findCurrentPassword($this->currentUserId, Hash::make($nowPassword)); if (!Hash::check(Input::get('now_password'), $currentUserP[0]->password)) { Session::flash('error', 'incorrect current password'); return Redirect::back()->withErrors('Password incorrect'); } User::updatePassword($this->currentUserId, Hash::make($password)); return Redirect::back()->with('success', true)->with('message', 'User updated.'); }