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

Commit 7f750b7d authored by Nivesh Krishna's avatar Nivesh Krishna
Browse files

add user to list

parent cf527e55
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ require_once('wp_account_creator.php');

$domain = getenv("DOMAIN");
$mail_domain = getMailDomain();
$newUserListFile = getenv('NEW_USER_LIST_FILE_PATH');

if (!isset($_POST['username']) || !isset($_POST['password']) || !isset($_POST['displayname']) || !isset($_POST['repassword'])) {
    $error_string = $strings["error_mandatory_missing"];
@@ -91,6 +92,7 @@ $userData->referrerCode = $referrerCode;
$accountsCreators = getAccountsCreators($domain);
validateAccountOnAllServices($accountsCreators, $userData);
createAccounts($accountsCreators, $userData);
addUserToList($user->email);

sendWelcomeMail($authmail, $mbox, $domain, $userData->name);
$done = "$authmail:$authsecret:$mbox";
@@ -261,3 +263,8 @@ function sendWelcomeMailWithSendGrid(string $to, string $mbox, string $domain, s
    sendEmailWithSendGrid($email);
}

function addUserToList(string $email)
{
    global $newUserListFile;
    return file_put_contents($newUserListFile, $email.PHP_EOL , FILE_APPEND | LOCK_EX);
}
 No newline at end of file