$msg .= error(sprintf(__('Please enter a valid nick.') . ' ' . __('Use up to 24 letters, numbers, connecting punctuations or spaces for your nickname.'),
$nick), true);
}
if (User::whereName($nick)->count() > 0) {
$valid = false;
$msg .= error(sprintf(__('Your nick "%s" already exists.'), $nick), true);
}
} else {
if (!$request->has('prename') || empty($preName = strip_request_item('prename'))) {
$valid = false;
$msg .= error(__('Please enter a nickname.'), true);
$msg .= error(__('Please enter your first name.'), true);
}
if ($request->has('email') && strlen(strip_request_item('email')) > 0) {
$email = strip_request_item('email');
if (!check_email($email)) {
$valid = false;
$msg .= error(__('E-mail address is not correct.'), true);
}
if (User::whereEmail($email)->first()) {
$valid = false;
$msg .= error(__('E-mail address is already used by another user.'), true);
}
} else {
if (!$request->has('lastname') || empty($lastName = strip_request_item('lastname'))) {
$valid = false;
$msg .= error(__('Please enter your e-mail.'), true);
}
if ($request->has('email_shiftinfo')) {
$email_shiftinfo = true;
}
if ($request->has('email_by_human_allowed')) {
$email_by_human_allowed = true;
$msg .= error(__('Please enter your last name.'), true);
}
if ($request->has('email_news')) {
$email_news = true;
if (!$request->has('mobile') || empty($mobile = strip_request_item('mobile'))) {
$valid = false;
$msg .= error(__('Please enter your mobile number.'), true);
} else if (User::whereName($mobile)->count() > 0) {
$valid = false;
$msg .= error(__('This mobile number is already in use.'), true);
}
if ($request->has('email_goody')) {
$email_goody = true;
if ($request->has('mobile_consent')) {
$mobile_consent = true;
} else {
$valid = false;
$msg .= error(__('Please consent to receiving notifications via SMS.'), true);
}
if ($enable_tshirt_size) {
@ -189,12 +160,6 @@ function guest_register()
}
// Trivia
if ($enable_user_name && $request->has('lastname')) {
$lastName = strip_request_item('lastname');
}
if ($enable_user_name && $request->has('prename')) {
$preName = strip_request_item('prename');
}
if ($enable_pronoun && $request->has('pronoun')) {
$pronoun = strip_request_item('pronoun');
}
@ -206,15 +171,12 @@ function guest_register()
error(__('For dect numbers are only 40 digits allowed.'));
}
}
if ($request->has('mobile')) {
$mobile = strip_request_item('mobile');
}
if ($valid) {
$user = new User([
'name' => $nick,
'name' => $mobile,
'password' => $password_hash,
'email' => $email,
'email' => $mobile,
'api_key' => '',
'last_login_at' => null,
]);
@ -242,10 +204,10 @@ function guest_register()
$settings = new Settings([
'language' => $session->get('locale'),
'theme' => config('theme'),
'email_human' => $email_by_human_allowed,
'email_goody' => $email_goody,
'email_shiftinfo' => $email_shiftinfo,
'email_news' => $email_news,
'email_human' => $mobile_consent,
'email_goody' => $mobile_consent,
'email_shiftinfo' => $mobile_consent,
'email_news' => $mobile_consent,
]);
$settings->user()
->associate($user)
@ -336,14 +298,6 @@ function guest_register()
$form_data = $session->get('form_data');
$session->remove('form_data');
if (!$nick && !empty($form_data['name'])) {
$nick = $form_data['name'];
}
if (!$email && !empty($form_data['email'])) {
$email = $form_data['email'];
}
if (!$preName && !empty($form_data['first_name'])) {
$preName = $form_data['first_name'];
}
@ -352,89 +306,54 @@ function guest_register()
$lastName = $form_data['last_name'];
}
if (!$mobile && !empty($form_data['phone_number'])) {
$mobile = $form_data['phone_number'];
}
return page_with_title(register_title(), [
__('By completing this form you\'re registering as a Chaos-Angel. This script will create you an account in the angel task scheduler.'),
form_element('', __('By completing this form you\'re registering as a Chaos-Angel. This script will create you an account in the angel task scheduler.')),
form_element('', '<spanclass="help-block">' . icon('info-circle') . sprintf(__('Please use at least %s characters.'), $min_password_length) . '</span>'),
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svgxmlns="http://www.w3.org/2000/svg"version="1.1"height="28.00242mm"width="28.00242mm"><pathstyle="fill:#231f20;fill-opacity:1;fill-rule:nonzero;stroke:none"d="M 25.83203,27.114244 C 11.6334,27.114244 0,38.747274 0,52.946274 c 0,14.19863 11.6334,25.775401 25.83203,25.775401 14.19875,0 25.77539,-11.576771 25.77539,-25.775401 0,-14.199 -11.57664,-25.83203 -25.77539,-25.83203 z m 54.22656,0 c -14.19863,0 -25.83008,11.63303 -25.83008,25.83203 0,14.19863 11.63145,25.775401 25.83008,25.775401 14.19875,0 25.77734,-11.576771 25.77734,-25.775401 0,-14.199 -11.57859,-25.83203 -25.77734,-25.83203 z m -62.14453,7.75391 h 6.16992 l 18.07617,18.07812 -18.02148,18.01953 h -6.28125 l 18.07617,-18.01953 z m 64.00195,0.0547 h 6.28125 l -18.07617,18.07618 18.07617,18.02148 H 81.9707 L 63.94921,52.999034 Z"/></svg>