Registration: Added autocompletion information and fixed naming
This commit is contained in:
parent
85baeb3a6b
commit
c44d48a22a
|
@ -41,7 +41,7 @@ function guest_register()
|
||||||
$preName = '';
|
$preName = '';
|
||||||
$dect = '';
|
$dect = '';
|
||||||
$mobile = '';
|
$mobile = '';
|
||||||
$mail = '';
|
$email = '';
|
||||||
$pronoun = '';
|
$pronoun = '';
|
||||||
$email_shiftinfo = false;
|
$email_shiftinfo = false;
|
||||||
$email_by_human_allowed = false;
|
$email_by_human_allowed = false;
|
||||||
|
@ -71,8 +71,8 @@ function guest_register()
|
||||||
if ($request->hasPostData('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
if ($request->has('nick')) {
|
if ($request->has('username')) {
|
||||||
$nickValidation = User_validate_Nick($request->input('nick'));
|
$nickValidation = User_validate_Nick($request->input('username'));
|
||||||
$nick = $nickValidation->getValue();
|
$nick = $nickValidation->getValue();
|
||||||
|
|
||||||
if (!$nickValidation->isValid()) {
|
if (!$nickValidation->isValid()) {
|
||||||
|
@ -89,13 +89,13 @@ function guest_register()
|
||||||
$msg .= error(__('Please enter a nickname.'), true);
|
$msg .= error(__('Please enter a nickname.'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('mail') && strlen(strip_request_item('mail')) > 0) {
|
if ($request->has('email') && strlen(strip_request_item('email')) > 0) {
|
||||||
$mail = strip_request_item('mail');
|
$email = strip_request_item('email');
|
||||||
if (!check_email($mail)) {
|
if (!check_email($email)) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(__('E-mail address is not correct.'), true);
|
$msg .= error(__('E-mail address is not correct.'), true);
|
||||||
}
|
}
|
||||||
if (User::whereEmail($mail)->first()) {
|
if (User::whereEmail($email)->first()) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(__('E-mail address is already used by another user.'), true);
|
$msg .= error(__('E-mail address is already used by another user.'), true);
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ function guest_register()
|
||||||
$user = new User([
|
$user = new User([
|
||||||
'name' => $nick,
|
'name' => $nick,
|
||||||
'password' => $password_hash,
|
'password' => $password_hash,
|
||||||
'email' => $mail,
|
'email' => $email,
|
||||||
'api_key' => '',
|
'api_key' => '',
|
||||||
'last_login_at' => null,
|
'last_login_at' => null,
|
||||||
]);
|
]);
|
||||||
|
@ -279,12 +279,25 @@ function guest_register()
|
||||||
div('col-md-6', [
|
div('col-md-6', [
|
||||||
div('row', [
|
div('row', [
|
||||||
div('col-sm-4', [
|
div('col-sm-4', [
|
||||||
form_text('nick', __('Nick') . ' ' . entry_required(), $nick),
|
form_text(
|
||||||
|
'username',
|
||||||
|
__('Nick') . ' ' . entry_required(),
|
||||||
|
$nick,
|
||||||
|
false,
|
||||||
|
23,
|
||||||
|
'nickname'
|
||||||
|
),
|
||||||
form_info('',
|
form_info('',
|
||||||
__('Use up to 23 letters, numbers, connecting punctuations or spaces for your nickname.'))
|
__('Use up to 23 letters, numbers, connecting punctuations or spaces for your nickname.'))
|
||||||
]),
|
]),
|
||||||
div('col-sm-8', [
|
div('col-sm-8', [
|
||||||
form_email('mail', __('E-Mail') . ' ' . entry_required(), $mail),
|
form_email(
|
||||||
|
'email',
|
||||||
|
__('E-Mail') . ' ' . entry_required(),
|
||||||
|
$email,
|
||||||
|
false,
|
||||||
|
'email'
|
||||||
|
),
|
||||||
form_checkbox(
|
form_checkbox(
|
||||||
'email_shiftinfo',
|
'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', [
|
div('row', [
|
||||||
$enable_planned_arrival ? div('col-sm-6', [
|
$enable_planned_arrival ? div('col-sm-6', [
|
||||||
form_date(
|
form_date(
|
||||||
|
@ -314,14 +335,6 @@ function guest_register()
|
||||||
$tshirt_sizes, $tshirt_size, __('Please select...')) : ''
|
$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(
|
form_checkboxes(
|
||||||
'angel_types',
|
'angel_types',
|
||||||
__('What do you want to do?') . sprintf(
|
__('What do you want to do?') . sprintf(
|
||||||
|
@ -340,10 +353,10 @@ function guest_register()
|
||||||
div('col-md-6', [
|
div('col-md-6', [
|
||||||
div('row', [
|
div('row', [
|
||||||
$enable_dect ? div('col-sm-4', [
|
$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', [
|
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', [
|
$enable_pronoun ? div('col-sm-4', [
|
||||||
form_text('pronoun', __('Pronoun'), $pronoun)
|
form_text('pronoun', __('Pronoun'), $pronoun)
|
||||||
|
@ -351,10 +364,10 @@ function guest_register()
|
||||||
]),
|
]),
|
||||||
$enable_user_name ? div('row', [
|
$enable_user_name ? div('row', [
|
||||||
div('col-sm-6', [
|
div('col-sm-6', [
|
||||||
form_text('prename', __('First name'), $preName)
|
form_text('prename', __('First name'), $preName, false, null, 'given-name')
|
||||||
]),
|
]),
|
||||||
div('col-sm-6', [
|
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!'))
|
form_info(entry_required() . ' = ' . __('Entry required!'))
|
||||||
|
|
|
@ -71,7 +71,7 @@ function form_date($name, $label, $value, $start_date = '', $end_date = '')
|
||||||
|
|
||||||
return form_element($label, '
|
return form_element($label, '
|
||||||
<div class="input-group date" id="' . $dom_id . '" data-min-date="' . $start_date . '" data-max-date="' . $end_date . '">
|
<div class="input-group date" id="' . $dom_id . '" data-min-date="' . $start_date . '" data-max-date="' . $end_date . '">
|
||||||
<input type="date" placeholder="YYYY-MM-DD" name="' . $name . '" class="form-control" value="' . htmlspecialchars($value) . '">'
|
<input type="date" placeholder="YYYY-MM-DD" name="' . $name . '" class="form-control" value="' . htmlspecialchars($value) . '" autocomplete="off">'
|
||||||
. '<span class="input-group-addon">' . glyph('th') . '</span>
|
. '<span class="input-group-addon">' . glyph('th') . '</span>
|
||||||
</div>
|
</div>
|
||||||
', $dom_id);
|
', $dom_id);
|
||||||
|
@ -230,18 +230,21 @@ function form_submit($name, $label, $class = '', $wrapForm = true, $buttonType =
|
||||||
* @param string $label
|
* @param string $label
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @param bool $disabled
|
* @param bool $disabled
|
||||||
* @param int $maxlength
|
* @param int|null $maxlength
|
||||||
|
* @param string|null $autocomplete
|
||||||
|
*
|
||||||
* @return string
|
* @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"' : '';
|
$disabled = $disabled ? ' disabled="disabled"' : '';
|
||||||
$maxlength = $maxlength ? ' maxlength=' . (int)$maxlength : '';
|
$maxlength = $maxlength ? ' maxlength=' . (int)$maxlength : '';
|
||||||
|
$autocomplete = $autocomplete ? ' autocomplete="' . $autocomplete . '"' : '';
|
||||||
|
|
||||||
return form_element(
|
return form_element(
|
||||||
$label,
|
$label,
|
||||||
'<input class="form-control" id="form_' . $name . '" type="text" name="' . $name
|
'<input class="form-control" id="form_' . $name . '" type="text" name="' . $name
|
||||||
. '" value="' . htmlspecialchars($value) . '"' . $maxlength . $disabled . '/>',
|
. '" value="' . htmlspecialchars($value) . '"' . $maxlength . $disabled . $autocomplete . '/>',
|
||||||
'form_' . $name
|
'form_' . $name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -272,15 +275,18 @@ function form_text_placeholder($name, $placeholder, $value, $disabled = false)
|
||||||
* @param string $label
|
* @param string $label
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @param bool $disabled
|
* @param bool $disabled
|
||||||
|
* @param string|null $autocomplete
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function form_email($name, $label, $value, $disabled = false)
|
function form_email($name, $label, $value, $disabled = false, $autocomplete = null)
|
||||||
{
|
{
|
||||||
$disabled = $disabled ? ' disabled="disabled"' : '';
|
$disabled = $disabled ? ' disabled="disabled"' : '';
|
||||||
|
$autocomplete = $autocomplete ? ' autocomplete="' . $autocomplete . '"' : '';
|
||||||
return form_element(
|
return form_element(
|
||||||
$label,
|
$label,
|
||||||
'<input class="form-control" id="form_' . $name . '" type="email" name="' . $name . '" value="'
|
'<input class="form-control" id="form_' . $name . '" type="email" name="' . $name . '" value="'
|
||||||
. htmlspecialchars($value) . '" ' . $disabled . '/>',
|
. htmlspecialchars($value) . '" ' . $disabled . $autocomplete . '/>',
|
||||||
'form_' . $name
|
'form_' . $name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue