Add max length for user settings
This commit is contained in:
parent
8284921ac5
commit
5cdf3889f9
|
@ -112,7 +112,7 @@ function User_validate_Nick($nick)
|
|||
{
|
||||
$nick = trim($nick);
|
||||
|
||||
if (strlen($nick) == 0 || strlen($nick) > 23) {
|
||||
if (strlen($nick) == 0 || strlen($nick) > 24) {
|
||||
return new ValidationResult(false, $nick);
|
||||
}
|
||||
if (preg_match('/([^\p{L}\p{N}\-_. ]+)/ui', $nick)) {
|
||||
|
|
|
@ -48,20 +48,20 @@ function admin_user()
|
|||
$html .= '<input type="hidden" name="Type" value="Normal">' . "\n";
|
||||
$html .= '<tr><td>' . "\n";
|
||||
$html .= '<table>' . "\n";
|
||||
$html .= ' <tr><td>Nick</td><td>' . '<input size="40" name="eNick" value="' . $user_source->name . '" class="form-control"></td></tr>' . "\n";
|
||||
$html .= ' <tr><td>Nick</td><td>' . '<input size="40" name="eNick" value="' . $user_source->name . '" class="form-control" maxlength="24"></td></tr>' . "\n";
|
||||
$html .= ' <tr><td>Last login</td><td><p class="help-block">'
|
||||
. ($user_source->last_login_at ? $user_source->last_login_at->format('Y-m-d H:i') : '-')
|
||||
. '</p></td></tr>' . "\n";
|
||||
if (config('enable_user_name')) {
|
||||
$html .= ' <tr><td>Name</td><td>' . '<input size="40" name="eName" value="' . $user_source->personalData->last_name . '" class="form-control"></td></tr>' . "\n";
|
||||
$html .= ' <tr><td>Vorname</td><td>' . '<input size="40" name="eVorname" value="' . $user_source->personalData->first_name . '" class="form-control"></td></tr>' . "\n";
|
||||
$html .= ' <tr><td>Name</td><td>' . '<input size="40" name="eName" value="' . $user_source->personalData->last_name . '" class="form-control" maxlength="64"></td></tr>' . "\n";
|
||||
$html .= ' <tr><td>Vorname</td><td>' . '<input size="40" name="eVorname" value="' . $user_source->personalData->first_name . '" class="form-control" maxlength="64"></td></tr>' . "\n";
|
||||
}
|
||||
$html .= ' <tr><td>Handy</td><td>' . '<input type= "tel" size="40" name="eHandy" value="' . $user_source->contact->mobile . '" class="form-control"></td></tr>' . "\n";
|
||||
$html .= ' <tr><td>Handy</td><td>' . '<input type= "tel" size="40" name="eHandy" value="' . $user_source->contact->mobile . '" class="form-control" maxlength="40"></td></tr>' . "\n";
|
||||
if (config('enable_dect')) {
|
||||
$html .= ' <tr><td>DECT</td><td>' . '<input size="40" name="eDECT" value="' . $user_source->contact->dect . '" class="form-control"></td></tr>' . "\n";
|
||||
$html .= ' <tr><td>DECT</td><td>' . '<input size="40" name="eDECT" value="' . $user_source->contact->dect . '" class="form-control" maxlength="40"></td></tr>' . "\n";
|
||||
}
|
||||
if ($user_source->settings->email_human) {
|
||||
$html .= " <tr><td>email</td><td>" . '<input type="email" size="40" name="eemail" value="' . $user_source->email . '" class="form-control"></td></tr>' . "\n";
|
||||
$html .= " <tr><td>email</td><td>" . '<input type="email" size="40" name="eemail" value="' . $user_source->email . '" class="form-control" maxlength="254"></td></tr>' . "\n";
|
||||
}
|
||||
$html .= ' <tr><td>Size</td><td>'
|
||||
. html_select_key(
|
||||
|
|
|
@ -78,7 +78,7 @@ function guest_register()
|
|||
|
||||
if (!$nickValidation->isValid()) {
|
||||
$valid = false;
|
||||
$msg .= error(sprintf(__('Please enter a valid nick.') . ' ' . __('Use up to 23 letters, numbers, connecting punctuations or spaces for your nickname.'),
|
||||
$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) {
|
||||
|
@ -323,11 +323,11 @@ function guest_register()
|
|||
__('Nick') . ' ' . entry_required(),
|
||||
$nick,
|
||||
false,
|
||||
23,
|
||||
24,
|
||||
'nickname'
|
||||
),
|
||||
form_info('',
|
||||
__('Use up to 23 letters, numbers, connecting punctuations or spaces for your nickname.'))
|
||||
__('Use up to 24 letters, numbers, connecting punctuations or spaces for your nickname.'))
|
||||
]),
|
||||
div('col-sm-8', [
|
||||
form_email(
|
||||
|
@ -335,7 +335,8 @@ function guest_register()
|
|||
__('E-Mail') . ' ' . entry_required(),
|
||||
$email,
|
||||
false,
|
||||
'email'
|
||||
'email',
|
||||
254
|
||||
),
|
||||
form_checkbox(
|
||||
'email_shiftinfo',
|
||||
|
@ -395,18 +396,18 @@ function guest_register()
|
|||
form_text('dect', __('DECT'), $dect, false, 40, 'tel-local')
|
||||
]) : '',
|
||||
div($enable_dect ? 'col-sm-4' : 'col-sm-12', [
|
||||
form_text('mobile', __('Mobile'), $mobile, false, null, 'tel-national')
|
||||
form_text('mobile', __('Mobile'), $mobile, false, 40, 'tel-national')
|
||||
]),
|
||||
$enable_pronoun ? div('col-sm-4', [
|
||||
form_text('pronoun', __('Pronoun'), $pronoun)
|
||||
form_text('pronoun', __('Pronoun'), $pronoun, false, 15)
|
||||
]) : '',
|
||||
]),
|
||||
$enable_user_name ? div('row', [
|
||||
div('col-sm-6', [
|
||||
form_text('prename', __('First name'), $preName, false, null, 'given-name')
|
||||
form_text('prename', __('First name'), $preName, false, 64, 'given-name')
|
||||
]),
|
||||
div('col-sm-6', [
|
||||
form_text('lastname', __('Last name'), $lastName, false, null, 'family-name')
|
||||
form_text('lastname', __('Last name'), $lastName, false, 64, 'family-name')
|
||||
])
|
||||
]) : '',
|
||||
form_info(entry_required() . ' = ' . __('Entry required!'))
|
||||
|
|
|
@ -276,17 +276,19 @@ function form_text_placeholder($name, $placeholder, $value, $disabled = false)
|
|||
* @param string $value
|
||||
* @param bool $disabled
|
||||
* @param string|null $autocomplete
|
||||
* @param int|null $maxlength
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function form_email($name, $label, $value, $disabled = false, $autocomplete = null)
|
||||
function form_email($name, $label, $value, $disabled = false, $autocomplete = null, $maxlength = null)
|
||||
{
|
||||
$disabled = $disabled ? ' disabled="disabled"' : '';
|
||||
$autocomplete = $autocomplete ? ' autocomplete="' . $autocomplete . '"' : '';
|
||||
$maxlength = $maxlength ? ' maxlength=' . (int)$maxlength : '';
|
||||
return form_element(
|
||||
$label,
|
||||
'<input class="form-control" id="form_' . $name . '" type="email" name="' . $name . '" value="'
|
||||
. htmlspecialchars($value) . '" ' . $disabled . $autocomplete . '/>',
|
||||
. htmlspecialchars($value) . '" ' . $disabled . $autocomplete . $maxlength . '/>',
|
||||
'form_' . $name
|
||||
);
|
||||
}
|
||||
|
|
|
@ -58,8 +58,12 @@ function User_settings_view(
|
|||
? form_text('pronoun', __('Pronoun'), $personalData->pronoun, false, 15)
|
||||
. form_info('', __('Will be shown on your profile page and in angel lists.'))
|
||||
: '',
|
||||
$enable_user_name ? form_text('lastname', __('Last name'), $personalData->last_name) : '',
|
||||
$enable_user_name ? form_text('prename', __('First name'), $personalData->first_name) : '',
|
||||
$enable_user_name
|
||||
? form_text('lastname', __('Last name'), $personalData->last_name, false, 64)
|
||||
: '',
|
||||
$enable_user_name
|
||||
? form_text('prename', __('First name'), $personalData->first_name, false, 64)
|
||||
: '',
|
||||
$enable_planned_arrival ? form_date(
|
||||
'planned_arrival_date',
|
||||
__('Planned date of arrival') . ' ' . entry_required(),
|
||||
|
@ -78,9 +82,9 @@ function User_settings_view(
|
|||
$buildup_start_date,
|
||||
$teardown_end_date
|
||||
) : '',
|
||||
$enable_dect ? form_text('dect', __('DECT'), $user_source->contact->dect) : '',
|
||||
form_text('mobile', __('Mobile'), $user_source->contact->mobile),
|
||||
form_text('mail', __('E-Mail') . ' ' . entry_required(), $user_source->email),
|
||||
$enable_dect ? form_text('dect', __('DECT'), $user_source->contact->dect, false, 40) : '',
|
||||
form_text('mobile', __('Mobile'), $user_source->contact->mobile, false, 40),
|
||||
form_text('mail', __('E-Mail') . ' ' . entry_required(), $user_source->email, false, 254),
|
||||
form_checkbox(
|
||||
'email_shiftinfo',
|
||||
__(
|
||||
|
|
|
@ -1547,10 +1547,10 @@ msgstr "Gib bitte einen erlaubten Nick an."
|
|||
#: includes/pages/guest_login.php:77 includes/pages/guest_login.php:277
|
||||
#: includes/view/User_view.php:42
|
||||
msgid ""
|
||||
"Use up to 23 letters, numbers, connecting punctuations or spaces for your "
|
||||
"Use up to 24 letters, numbers, connecting punctuations or spaces for your "
|
||||
"nickname."
|
||||
msgstr ""
|
||||
"Verwende bis zu 23 Buchstaben, Zahlen, verbindende Schriftzeichen (.-_) oder "
|
||||
"Verwende bis zu 24 Buchstaben, Zahlen, verbindende Schriftzeichen (.-_) oder "
|
||||
"Leerzeichen für deinen Nick."
|
||||
|
||||
#: includes/pages/guest_login.php:82
|
||||
|
|
Loading…
Reference in New Issue