if ($val->sanitizePost('captcha') != $val->fromSession('captcha')) { $errors[] = $val->lang()->translate('The verification number (also known as Captcha) that you entered is incorrect. If you are having problems reading the Captcha, please email to: <a href="mailto:{{SERVER_EMAIL}}">{{SERVER_EMAIL}}</a>', array('SERVER_EMAIL' => SERVER_EMAIL)); } } } /* if ( isset( $_SESSION['captcha'] ) ) { unset( $_SESSION['captcha'] ); } */ if (!count($errors)) { // Generate a random password $new_pass = $users->generateRandomString(8); $md5_password = md5($new_pass); $result = $users->createUser($groups_id, $active, $username, $md5_password, $display_name, $email, CAT_Users::get_home_folder()); if (!is_bool($result)) { $errors[] = $val->lang()->translate('Unable to create user account. Please contact the administrator.'); } else { // Setup email to send $mail_to = $email; $mail_subject = $val->lang()->translate('Your login details...'); $mail_message = $parser->get('account_signup_mail_body', array('LOGIN_DISPLAY_NAME' => $display_name, 'LOGIN_WEBSITE_TITLE' => WEBSITE_TITLE, 'LOGIN_NAME' => $username, 'LOGIN_PASSWORD' => $new_pass, 'SERVER_EMAIL' => SERVER_EMAIL)); // Try sending the email if (!CAT_Helper_Mail::getInstance()->sendMail(SERVER_EMAIL, $mail_to, $mail_subject, $mail_message, CATMAILER_DEFAULT_SENDERNAME)) { $database->query("DELETE FROM `:prefix:users` WHERE username=:name", array('name' => $username)); $errors[] = $val->lang()->translate('Unable to email password, please contact system administrator'); } else { $message = $val->lang()->translate('Registration process completed!<br /><br />You should receive an eMail with your login data. If not, please contact {{SERVER_EMAIL}}.', array('SERVER_EMAIL' => SERVER_EMAIL)); $form = false; }
public function get_home_folder() { return CAT_Users::get_home_folder(); }