Loading htdocs/create.php +12 −1 Original line number Diff line number Diff line Loading @@ -29,9 +29,19 @@ $pw2 = $_POST['repassword']; $name = $_POST['displayname']; $authmail = $_POST['authmail']; $authsecret = $_POST['authsecret']; $referrerCode = isset($_POST["ref"]) ? $_POST["ref"] : null; $referrerCode = is_string($referrerCode) ? $referrerCode : null; $resultmail = $mbox . "@" . $mail_domain; if (strlen($mbox) > 30 || strlen($name) > 30 || strlen($pw) > 1024 || strlen($pw2) > 1024 || strlen($authmail) > 1024 || strlen($authsecret) > 1024) { if ( strlen($mbox) > 30 || strlen($name) > 30 || strlen($pw) > 1024 || strlen($pw2) > 1024 || strlen($authmail) > 1024 || strlen($authsecret) > 1024 || is_string($referrerCode) && strlen($referrerCode) > 1024 ) { $error_string = $strings["error_input_too_large"]; sendAPIResponse(400, createAPIResponse("general", $error_string)); } Loading Loading @@ -76,6 +86,7 @@ $userData->username = $mbox; $userData->email = $resultmail; $userData->authmail = $authmail; $userData->password = $pw; $userData->referrerCode = $referrerCode; $accountsCreators = getAccountsCreators($domain); validateAccountOnAllServices($accountsCreators, $userData); Loading htdocs/ecloud_account_creator.php +2 −2 Original line number Diff line number Diff line Loading @@ -101,7 +101,7 @@ class ECloudAccountCreator implements AccountCreator return $answer; } private function createMailAccount($resultmail, $pw, $pw2, $name, $quota, $authmail) private function createMailAccount($resultmail, $pw, $pw2, $name, $quota, $authmail, ?string $referrerCode = null) { global $strings; $PF_HOSTNAME = "postfixadmin"; Loading Loading @@ -135,7 +135,7 @@ class ECloudAccountCreator implements AccountCreator { global $strings; $pw = $userData->password; $answer = $this->createMailAccount($userData->email, $pw, $pw, $userData->name, $this->quotaInMB, $userData->authmail); $answer = $this->createMailAccount($userData->email, $pw, $pw, $userData->name, $this->quotaInMB, $userData->authmail, $userData->referrerCode); if ($answer->success === false) { sendAPIResponse(400, createAPIResponse("general", $strings[$answer->type])); } Loading htdocs/email_invite.html +6 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,12 @@ flags: </div> </div> <input class="requestInput" id="ref" name="ref" type="hidden" /> <div class="field has-text-centered" id="buttonField"> <div class="control"> <button class="button is-rounded" id="submitButton" type="submit"> Loading htdocs/helpers.php +4 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ function isEmailDomainBlackListed($email): bool return in_array($domain, $blacklisted); } function sendInviteMail($to, $secret, $lang) function sendInviteMail($to, $secret, $lang, ?string $referrer = null) { $encoded_email = urlencode($to); $domain = getenv("DOMAIN"); Loading @@ -44,6 +44,9 @@ function sendInviteMail($to, $secret, $lang) $signupURL .= "$lang/"; } $signupURL .= "register?authmail=$encoded_email&authsecret=$secret"; if ($referrer != null) { $signupURL .= "&ref=$referrer"; } $SENDGRID_API_KEY = getenv("SENDGRID_API_KEY"); if (!empty($SENDGRID_API_KEY)) { return sendInviteMailWithSendGrid($to, $signupURL); Loading htdocs/index.php +3 −5 Original line number Diff line number Diff line <?php $domain = getenv("DOMAIN"); $qs = $_SERVER['QUERY_STRING']; if (strpos($qs, "authmail") !== false && strpos($qs, "authsecret") !== false) { header("Location: https://welcome.$domain/register?" . $qs); die(); header("Location: /register?" . $qs); } else { header("Location: https://welcome.$domain/e-email-invite"); die(); header("Location: /e-email-invite"); } die(); Loading
htdocs/create.php +12 −1 Original line number Diff line number Diff line Loading @@ -29,9 +29,19 @@ $pw2 = $_POST['repassword']; $name = $_POST['displayname']; $authmail = $_POST['authmail']; $authsecret = $_POST['authsecret']; $referrerCode = isset($_POST["ref"]) ? $_POST["ref"] : null; $referrerCode = is_string($referrerCode) ? $referrerCode : null; $resultmail = $mbox . "@" . $mail_domain; if (strlen($mbox) > 30 || strlen($name) > 30 || strlen($pw) > 1024 || strlen($pw2) > 1024 || strlen($authmail) > 1024 || strlen($authsecret) > 1024) { if ( strlen($mbox) > 30 || strlen($name) > 30 || strlen($pw) > 1024 || strlen($pw2) > 1024 || strlen($authmail) > 1024 || strlen($authsecret) > 1024 || is_string($referrerCode) && strlen($referrerCode) > 1024 ) { $error_string = $strings["error_input_too_large"]; sendAPIResponse(400, createAPIResponse("general", $error_string)); } Loading Loading @@ -76,6 +86,7 @@ $userData->username = $mbox; $userData->email = $resultmail; $userData->authmail = $authmail; $userData->password = $pw; $userData->referrerCode = $referrerCode; $accountsCreators = getAccountsCreators($domain); validateAccountOnAllServices($accountsCreators, $userData); Loading
htdocs/ecloud_account_creator.php +2 −2 Original line number Diff line number Diff line Loading @@ -101,7 +101,7 @@ class ECloudAccountCreator implements AccountCreator return $answer; } private function createMailAccount($resultmail, $pw, $pw2, $name, $quota, $authmail) private function createMailAccount($resultmail, $pw, $pw2, $name, $quota, $authmail, ?string $referrerCode = null) { global $strings; $PF_HOSTNAME = "postfixadmin"; Loading Loading @@ -135,7 +135,7 @@ class ECloudAccountCreator implements AccountCreator { global $strings; $pw = $userData->password; $answer = $this->createMailAccount($userData->email, $pw, $pw, $userData->name, $this->quotaInMB, $userData->authmail); $answer = $this->createMailAccount($userData->email, $pw, $pw, $userData->name, $this->quotaInMB, $userData->authmail, $userData->referrerCode); if ($answer->success === false) { sendAPIResponse(400, createAPIResponse("general", $strings[$answer->type])); } Loading
htdocs/email_invite.html +6 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,12 @@ flags: </div> </div> <input class="requestInput" id="ref" name="ref" type="hidden" /> <div class="field has-text-centered" id="buttonField"> <div class="control"> <button class="button is-rounded" id="submitButton" type="submit"> Loading
htdocs/helpers.php +4 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ function isEmailDomainBlackListed($email): bool return in_array($domain, $blacklisted); } function sendInviteMail($to, $secret, $lang) function sendInviteMail($to, $secret, $lang, ?string $referrer = null) { $encoded_email = urlencode($to); $domain = getenv("DOMAIN"); Loading @@ -44,6 +44,9 @@ function sendInviteMail($to, $secret, $lang) $signupURL .= "$lang/"; } $signupURL .= "register?authmail=$encoded_email&authsecret=$secret"; if ($referrer != null) { $signupURL .= "&ref=$referrer"; } $SENDGRID_API_KEY = getenv("SENDGRID_API_KEY"); if (!empty($SENDGRID_API_KEY)) { return sendInviteMailWithSendGrid($to, $signupURL); Loading
htdocs/index.php +3 −5 Original line number Diff line number Diff line <?php $domain = getenv("DOMAIN"); $qs = $_SERVER['QUERY_STRING']; if (strpos($qs, "authmail") !== false && strpos($qs, "authsecret") !== false) { header("Location: https://welcome.$domain/register?" . $qs); die(); header("Location: /register?" . $qs); } else { header("Location: https://welcome.$domain/e-email-invite"); die(); header("Location: /e-email-invite"); } die();