diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php index 3e3317e4..e2e41d50 100644 --- a/includes/pages/guest_login.php +++ b/includes/pages/guest_login.php @@ -41,7 +41,7 @@ function guest_register() $preName = ''; $dect = ''; $mobile = ''; - $mail = ''; + $email = ''; $pronoun = ''; $email_shiftinfo = false; $email_by_human_allowed = false; @@ -71,8 +71,8 @@ function guest_register() if ($request->hasPostData('submit')) { $valid = true; - if ($request->has('nick')) { - $nickValidation = User_validate_Nick($request->input('nick')); + if ($request->has('username')) { + $nickValidation = User_validate_Nick($request->input('username')); $nick = $nickValidation->getValue(); if (!$nickValidation->isValid()) { @@ -89,13 +89,13 @@ function guest_register() $msg .= error(__('Please enter a nickname.'), true); } - if ($request->has('mail') && strlen(strip_request_item('mail')) > 0) { - $mail = strip_request_item('mail'); - if (!check_email($mail)) { + 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($mail)->first()) { + if (User::whereEmail($email)->first()) { $valid = false; $msg .= error(__('E-mail address is already used by another user.'), true); } @@ -180,7 +180,7 @@ function guest_register() $user = new User([ 'name' => $nick, 'password' => $password_hash, - 'email' => $mail, + 'email' => $email, 'api_key' => '', 'last_login_at' => null, ]); @@ -279,12 +279,25 @@ function guest_register() div('col-md-6', [ div('row', [ div('col-sm-4', [ - form_text('nick', __('Nick') . ' ' . entry_required(), $nick), + form_text( + 'username', + __('Nick') . ' ' . entry_required(), + $nick, + false, + 23, + 'nickname' + ), form_info('', __('Use up to 23 letters, numbers, connecting punctuations or spaces for your nickname.')) ]), div('col-sm-8', [ - form_email('mail', __('E-Mail') . ' ' . entry_required(), $mail), + form_email( + 'email', + __('E-Mail') . ' ' . entry_required(), + $email, + false, + 'email' + ), form_checkbox( 'email_shiftinfo', __( @@ -300,6 +313,14 @@ function guest_register() ) ]) ]), + div('row', [ + div('col-sm-6', [ + form_password('password', __('Password') . ' ' . entry_required()) + ]), + div('col-sm-6', [ + form_password('password2', __('Confirm password') . ' ' . entry_required()) + ]) + ]), div('row', [ $enable_planned_arrival ? div('col-sm-6', [ form_date( @@ -314,14 +335,6 @@ function guest_register() $tshirt_sizes, $tshirt_size, __('Please select...')) : '' ]) ]), - div('row', [ - div('col-sm-6', [ - form_password('password', __('Password') . ' ' . entry_required()) - ]), - div('col-sm-6', [ - form_password('password2', __('Confirm password') . ' ' . entry_required()) - ]) - ]), form_checkboxes( 'angel_types', __('What do you want to do?') . sprintf( @@ -340,10 +353,10 @@ function guest_register() div('col-md-6', [ div('row', [ $enable_dect ? div('col-sm-4', [ - form_text('dect', __('DECT'), $dect) + form_text('dect', __('DECT'), $dect, false, 40, 'tel-local') ]) : '', div($enable_dect ? 'col-sm-4' : 'col-sm-12', [ - form_text('mobile', __('Mobile'), $mobile) + form_text('mobile', __('Mobile'), $mobile, false, null, 'tel-national') ]), $enable_pronoun ? div('col-sm-4', [ form_text('pronoun', __('Pronoun'), $pronoun) @@ -351,10 +364,10 @@ function guest_register() ]), $enable_user_name ? div('row', [ div('col-sm-6', [ - form_text('prename', __('First name'), $preName) + form_text('prename', __('First name'), $preName, false, null, 'given-name') ]), div('col-sm-6', [ - form_text('lastname', __('Last name'), $lastName) + form_text('lastname', __('Last name'), $lastName, false, null, 'family-name') ]) ]) : '', form_info(entry_required() . ' = ' . __('Entry required!')) diff --git a/includes/sys_form.php b/includes/sys_form.php index ed4a65c8..287fbb26 100644 --- a/includes/sys_form.php +++ b/includes/sys_form.php @@ -71,7 +71,7 @@ function form_date($name, $label, $value, $start_date = '', $end_date = '') return form_element($label, '
- ' + ' . '' . glyph('th') . '
', $dom_id); @@ -226,22 +226,25 @@ function form_submit($name, $label, $class = '', $wrapForm = true, $buttonType = /** * Rendert ein Formular-Textfeld * - * @param string $name - * @param string $label - * @param string $value - * @param bool $disabled - * @param int $maxlength + * @param string $name + * @param string $label + * @param string $value + * @param bool $disabled + * @param int|null $maxlength + * @param string|null $autocomplete + * * @return string */ -function form_text($name, $label, $value, $disabled = false, $maxlength = null) +function form_text($name, $label, $value, $disabled = false, $maxlength = null, $autocomplete = null) { $disabled = $disabled ? ' disabled="disabled"' : ''; $maxlength = $maxlength ? ' maxlength=' . (int)$maxlength : ''; + $autocomplete = $autocomplete ? ' autocomplete="' . $autocomplete . '"' : ''; return form_element( $label, '', + . '" value="' . htmlspecialchars($value) . '"' . $maxlength . $disabled . $autocomplete . '/>', 'form_' . $name ); } @@ -268,19 +271,22 @@ function form_text_placeholder($name, $placeholder, $value, $disabled = false) /** * Rendert ein Formular-Emailfeld * - * @param string $name - * @param string $label - * @param string $value - * @param bool $disabled + * @param string $name + * @param string $label + * @param string $value + * @param bool $disabled + * @param string|null $autocomplete + * * @return string */ -function form_email($name, $label, $value, $disabled = false) +function form_email($name, $label, $value, $disabled = false, $autocomplete = null) { $disabled = $disabled ? ' disabled="disabled"' : ''; + $autocomplete = $autocomplete ? ' autocomplete="' . $autocomplete . '"' : ''; return form_element( $label, '', + . htmlspecialchars($value) . '" ' . $disabled . $autocomplete . '/>', 'form_' . $name ); }