231 $form_valid = $this->
form->checkInput();
234 $valid_code = $valid_role =
false;
237 if ($this->code_enabled) {
238 $code = $this->
form->getInput(
'usr_registration_code');
242 $this->registration_settings->registrationCodeRequired()
246 $code_obj = $this->
form->getItemByPostVar(
'usr_registration_code');
247 $code_obj->setAlert($this->
lng->txt(
'registration_code_not_valid'));
254 if ($role_id && $this->rbacreview->isGlobalRole($role_id)) {
255 $valid_role = $role_id;
268 foreach ($this->registration_settings->getAllowedDomains() as $item) {
273 if (count($domains)) {
275 foreach ($domains as $domain) {
276 $domain = str_replace(
"*",
"~~~", $domain);
277 $domain = preg_quote($domain,
'/');
278 $domain = str_replace(
"~~~",
".+", $domain);
279 if (preg_match(
"/^" . $domain .
"$/",
$email, $hit)) {
285 $mail_obj = $this->
form->getItemByPostVar(
'usr_email');
286 $mail_obj->setAlert(sprintf(
287 $this->
lng->txt(
"reg_email_domains"),
288 implode(
", ", $domains)
298 !$this->registration_settings->passwordGenerationEnabled() &&
300 $this->
form->getInput(
'usr_password'),
301 $this->
form->getInput(
'username'),
305 $passwd_obj = $this->
form->getItemByPostVar(
'usr_password');
306 $passwd_obj->setAlert($this->
lng->txt($error_lng_var));
310 $showGlobalTermsOfServieFailure =
false;
312 $agr_obj = $this->
form->getItemByPostVar(
'accept_terms_of_service');
314 $agr_obj->setAlert($this->
lng->txt(
'force_accept_usr_agreement'));
317 $showGlobalTermsOfServieFailure =
true;
324 if ($this->registration_settings->roleSelectionEnabled()) {
325 $selected_role = $this->
form->getInput(
"usr_roles");
327 $valid_role = (
int) $selected_role;
332 $valid_role = $registration_role_assignments->getRoleByEmail($this->
form->getInput(
"usr_email"));
338 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"registration_no_valid_role"));
343 $login_obj = $this->
form->getItemByPostVar(
'username');
344 $login = $this->
form->getInput(
"username");
346 $login_obj->setAlert($this->
lng->txt(
"login_invalid"));
352 $login_obj->setAlert($this->
lng->txt(
"login_exists"));
354 } elseif ((
int) $this->
settings->get(
'allow_change_loginname') &&
355 (
int) $this->
settings->get(
'reuse_of_loginnames') === 0 &&
357 $login_obj->setAlert($this->
lng->txt(
'login_exists'));
363 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'form_input_not_valid'));
364 } elseif ($showGlobalTermsOfServieFailure) {
365 $this->
lng->loadLanguageModule(
'tos');
366 $this->tpl->setOnScreenMessage(
'failure', sprintf(
367 $this->
lng->txt(
'tos_account_reg_not_possible'),
371 $password = $this->createUser($valid_role);
373 return $this->
login();
375 $this->
form->setValuesByPost();
static getCodeRole(string $code)
Class class.ilregistrationEmailRoleAssignments.
static isValidRegistrationCode(string $a_code)
static _loginExists(string $a_login, int $a_user_id=0)
check if a login name already exists You may exclude a user from the check by giving his user id as 2...
static isLogin(string $a_login)
static isPasswordValidForUserContext(string $clear_text_password, $user, ?string &$error_language_variable=null)
form( $class_path, string $cmd)
static _doesLoginnameExistInHistory(string $a_login)
Checks whether the passed loginname already exists in history.
distributeMails(string $password)
static _lookupAllowRegister(int $a_role_id)
check whether role is allowed in user registration or not