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

Commit bfe83f4b authored by AVINASH GUSAIN's avatar AVINASH GUSAIN
Browse files

by pass captcha

parent 32e8a02c
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -253,15 +253,18 @@ class AccountController extends Controller {
	 *
	 * @return \OCP\AppFramework\Http\DataResponse
	 */
	public function verifyCaptcha(string $captchaInput = '') : DataResponse {
	public function verifyCaptcha(string $captchaInput = '', string $bypassToken = '') : DataResponse {
		$response = new DataResponse();
		
		$captchaResult = (string) $this->session->get(CaptchaService::CAPTCHA_RESULT_KEY, '');
		$captchaToken = $this->config->getSystemValue('bypass_captcha_token', '');
		// Initialize the default status to 400 (Bad Request)
		$response->setStatus(400);
		if ($captchaResult === $captchaInput) {
		// Check if the input matches the bypass token or the stored captcha result
		$captchaResult = (string) $this->session->get(CaptchaService::CAPTCHA_RESULT_KEY, '');
		if ((!empty($captchaToken) && $bypassToken === $captchaToken) || (!empty($captchaResult) && $captchaInput === $captchaResult)) {
			$this->session->set(self::CAPTCHA_VERIFIED_CHECK, true);
			$response->setStatus(200);
		}

		$this->session->remove(CaptchaService::CAPTCHA_RESULT_KEY);
		return $response;
	}
+3 −1
Original line number Diff line number Diff line
@@ -3,7 +3,9 @@
		<section id="main" class="register-page">
			<div id="registration">
				<RegistrationForm v-if="showRegistrationForm" v-model="formData" @form-submitted="submitRegistrationForm" />
				<CaptchaForm v-if="showCaptchaForm" v-model="formData" @form-submitted="submitCaptchaForm" />
				<CaptchaForm v-if="showCaptchaForm"
					v-model="formData"
					@form-submitted="submitCaptchaForm" />
				<RecoveryEmailForm v-if="showRecoveryEmailForm" v-model="formData" @form-submitted="submitRecoveryEmailForm" />
				<SuccessSection v-if="showSuccessSection" v-model="formData" />
			</div>
+3 −0
Original line number Diff line number Diff line
@@ -85,8 +85,11 @@ export default {
			this.validation.isCaptchaInputNotMatched = false

			try {
				const urlParams = new URLSearchParams(window.location.search)
				const bypassToken = urlParams.get('bypassToken')
				const data = {
					captchaInput: this.formData.captchaInput,
					bypassToken: bypassToken || null,
				}
				const url = generateUrl(`/apps/${this.appName}/accounts/verify_captcha`)
				await Axios.post(url, data)