$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);
}
if ($request->has('prename')) {
$preName = strip_request_item('prename');
} else {
$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);
}
if ($request->has('lastname')) {
$lastName = strip_request_item('lastname');
} else {
$valid = false;
$msg .= error(__('Please enter your e-mail.'), true);
}
if ($request->has('email_shiftinfo')) {
$email_shiftinfo = true;
$msg .= error(__('Please enter your last name.'), true);
}
if ($request->has('email_by_human_allowed')) {
$email_by_human_allowed = true;
}
if ($request->has('mobile')) {
$mobile = strip_request_item('mobile');
if ($request->has('email_news')) {
$email_news = true;
if (User::whereName($mobile)->count() > 0) {
$valid = false;
$msg .= error(__('This mobile number is already in use.'), true);
}
} else {
$valid = false;
$msg .= error(__('Please enter your mobile number.'), 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 +168,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 +179,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 +212,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 +306,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'];
}
@ -360,79 +322,39 @@ function guest_register()
form([
div('row', [
div('col', [
form_text(
'username',
__('Nick') . ' ' . entry_required(),
$nick,
false,
24,
'nickname'
),
form_info('',
__('Use up to 24 letters, numbers, connecting punctuations or spaces for your nickname.'))