diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 505831be12a37106f0349771ad28d728261b3d09..9bbebb5f1e43e4f4055ace45efbf3e8d33515b0c 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -30,6 +30,9 @@ class AccountController extends Controller { private $session; private $userSession; private $urlGenerator; + + private const CAPTCHA_VERIFIED_CHECK = 'captcha_verified'; + public function __construct( $AppName, IRequest $request, @@ -62,6 +65,9 @@ class AccountController extends Controller { if ($this->userSession->isLoggedIn()) { return new RedirectResponse($this->urlGenerator->linkToDefaultPageUrl()); } + + $_SERVER['HTTP_ACCEPT_LANGUAGE'] = $lang; + return new TemplateResponse( Application::APP_ID, 'signup', @@ -86,7 +92,7 @@ class AccountController extends Controller { $response = new DataResponse(); - if(!$this->session->get('captcha_verified')) { + if(!$this->session->get(self::CAPTCHA_VERIFIED_CHECK)) { $response->setData(['message' => 'Captcha is not verified!', 'success' => false]); $response->setStatus(400); return $response; @@ -132,6 +138,7 @@ class AccountController extends Controller { $response->setData(['message' => $e->getMessage(), 'success' => false]); $response->setStatus(500); } + $this->session->remove(self::CAPTCHA_VERIFIED_CHECK); return $response; } /** @@ -204,7 +211,7 @@ class AccountController extends Controller { $response->setStatus(400); if ($captchaResult === $captchaInput) { $this->session->remove('captcha_result'); - $this->session->set('captcha_verified', true); + $this->session->set(self::CAPTCHA_VERIFIED_CHECK, true); $response->setStatus(200); } return $response;