Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit ad2dbabe authored by Akhil's avatar Akhil
Browse files

Fix captcha_result as const

parent 07413ce7
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -234,10 +234,10 @@ class AccountController extends Controller {
	public function verifyCaptcha(string $captchaInput = '') : DataResponse {
		$response = new DataResponse();
		
		$captchaResult = (string) $this->session->get('captcha_result', '');
		$captchaResult = (string) $this->session->get(CaptchaService::CAPTCHA_RESULT_KEY, '');
		$response->setStatus(400);
		if ($captchaResult === $captchaInput) {
			$this->session->remove('captcha_result');
			$this->session->remove(CaptchaService::CAPTCHA_RESULT_KEY);
			$this->session->set(self::CAPTCHA_VERIFIED_CHECK, true);
			$response->setStatus(200);
		}
+2 −1
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ class CaptchaService {
	public const NUMBERS = '123456789';
	public const SYMBOLS = '+-';
	public const NOISE_LEVEL = 13;
	public const CAPTCHA_RESULT_KEY = 'captcha_result';

	public function __construct(ISession $session) {
		$this->session = $session;
@@ -195,7 +196,7 @@ class CaptchaService {
	 * @return void
	 */
	private function updateSession(float $captchaResult): void {
		$this->session->set('captcha_result', $captchaResult);
		$this->session->set(self::CAPTCHA_RESULT_KEY, $captchaResult);
	}