public function postResetPassword() { if (!($data = \Input::get('data'))) { return \Response::json(['type' => 'danger', 'message' => 'Email and reset code not found.']); } try { $user = \User::findUserByLogin($data['e']); if ($user->hasAccess('admin')) { throw new \Exception("Account not elligible to reset from here.", 1); return; } $user->attemptResetPassword($data['c'], $data['password']); return \Response::json(['type' => 'success', 'message' => 'Successfully reset password. You can login <a href="' . route('front.login') . '">here</a>']); } catch (\Exception $e) { return \Response::json(['type' => 'danger', 'message' => $e->getMessage()]); } }