$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 {
} else {
$valid = false;
$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) {
if ($request->has('lastname')) {
$email = strip_request_item('email');
$lastName = strip_request_item('lastname');
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 {
} else {
$valid = false;
$valid = false;
$msg .= error(__('Please enter your e-mail.'), true);
$msg .= error(__('Please enter your last name.'), true);
}
}
if ($request->has('email_shiftinfo')) {
if ($request->has('mobile')) {
$email_shiftinfo = true;
$mobile = strip_request_item('mobile');
}
if ($request->has('email_by_human_allowed')) {
if (User::whereName($mobile)->count() > 0) {
$email_by_human_allowed = true;
$valid = false;
$msg .= error(__('This mobile number is already in use.'), true);
}
}
} else {
if ($request->has('email_news')) {
$valid = false;
$email_news = true;
$msg .= error(__('Please enter your mobile number.'), true);
}
}
if ($request->has('email_goody')) {
if ($request->has('mobile_consent')) {
$email_goody = true;
$mobile_consent = true;
} else {
$valid = false;
$msg .= error(__('Please consent to receiving notifications via SMS.'), true);
}
}
if ($enable_tshirt_size) {
if ($enable_tshirt_size) {
@ -189,12 +168,6 @@ function guest_register()
}
}
// Trivia
// 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')) {
if ($enable_pronoun && $request->has('pronoun')) {
$pronoun = strip_request_item('pronoun');
$pronoun = strip_request_item('pronoun');
}
}
@ -206,15 +179,12 @@ function guest_register()
error(__('For dect numbers are only 40 digits allowed.'));
error(__('For dect numbers are only 40 digits allowed.'));
}
}
}
}
if ($request->has('mobile')) {
$mobile = strip_request_item('mobile');
}
if ($valid) {
if ($valid) {
$user = new User([
$user = new User([
'name' => $nick,
'name' => $mobile,
'password' => $password_hash,
'password' => $password_hash,
'email' => $email,
'email' => $mobile,
'api_key' => '',
'api_key' => '',
'last_login_at' => null,
'last_login_at' => null,
]);
]);
@ -242,10 +212,10 @@ function guest_register()
$settings = new Settings([
$settings = new Settings([
'language' => $session->get('locale'),
'language' => $session->get('locale'),
'theme' => config('theme'),
'theme' => config('theme'),
'email_human' => $email_by_human_allowed,
'email_human' => $mobile_consent,
'email_goody' => $email_goody,
'email_goody' => $mobile_consent,
'email_shiftinfo' => $email_shiftinfo,
'email_shiftinfo' => $mobile_consent,
'email_news' => $email_news,
'email_news' => $mobile_consent,
]);
]);
$settings->user()
$settings->user()
->associate($user)
->associate($user)
@ -336,14 +306,6 @@ function guest_register()
$form_data = $session->get('form_data');
$form_data = $session->get('form_data');
$session->remove('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'])) {
if (!$preName && !empty($form_data['first_name'])) {