public function resetPassword($input)
{
$input = array_except($input, '_token');
$resetUser = null;
$response = $this->Framework->Password->reset($input, function ($user, $password) use(&$resetUser) {
$user->password = $this->Hash->make($password);
$user->save();
$resetUser = $user;
});
switch ($response) {
case \Password::INVALID_PASSWORD:
case \Password::INVALID_TOKEN:
case \Password::INVALID_USER:
$this->message = 'There were validation errors.';
$this->errors = $this->Lang->get($response);
return false;
break;
case \Password::PASSWORD_RESET:
$this->Auth->login($resetUser);
$this->message = 'Password successfully changed.';
return true;
break;
}
}