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

Commit 2f062f8f authored by Israel Yago Pereira's avatar Israel Yago Pereira
Browse files

Bypassing captcha with token for QA

parent 72f8b7f6
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ docker build -t registry.gitlab.e.foundation:5000/e/infra/docker-welcome:yourtag

# Account creation

The account creation has a captcha built-in. If you wish to use any tool to bypass this captcha, you need to set the ENV variable `BYPASS_CAPTCHA_TOKEN` with any token/hash that you want. Then, when sending the request to `process_email_invite.php` you need to set the GET parameter `bypass_captcha_token`;

## Ecloud

To be able to create an ecloud account, you need to set the ENV variable `ECLOUD_ACCOUNTS_SECRET`
+13 −1
Original line number Diff line number Diff line
@@ -57,7 +57,9 @@ else {
    $email2 = strtolower(htmlspecialchars($_POST["mail2"]));
}

if (shouldCheckCaptcha()) {
    captcha_check($email1, $from_easy_installer);
}
email_check($email1, $email2, $from_easy_installer);

unset($_SESSION['securecode']);
@@ -199,3 +201,13 @@ function captcha_check($email, $from_easy_installer)
function isAccountCreationDisabled(): bool {
    return getenv("CREATION_DISABLED") == 1;
}

function shouldCheckCaptcha(): bool {
    $bypassCaptchaToken = getenv("BYPASS_CAPTCHA_TOKEN");
    if (!isset($_GET['bypass_captcha_token']) || $bypassCaptchaToken === false) {
        return true;
    }

    $token = is_string($_GET['bypass_captcha_token']) ? $_GET['bypass_captcha_token'] : '';
    return $token !== $bypassCaptchaToken;
}
 No newline at end of file