Visman 2023-07-17 20:03:23 +07:00
parent deadb448d4
commit 1000a97430
8 changed files with 19 additions and 7 deletions

View file

@ -96,6 +96,7 @@ class NewUser extends Users
'username' => [
'autofocus' => true,
'type' => 'text',
'minlength' => $this->c->USERNAME['min'],
'maxlength' => $this->user->isAdmin ? '190' : $this->c->USERNAME['max'],
'value' => $data['username'] ?? null,
'caption' => 'Username',
@ -110,7 +111,7 @@ class NewUser extends Users
'caption' => 'Email',
'help' => 'Email help',
'required' => true,
'pattern' => '.+@.+',
'pattern' => '^.*[^@]@[^@].*$',
'autocapitalize' => 'off',
],
'password' => [
@ -118,7 +119,8 @@ class NewUser extends Users
'caption' => 'Passphrase',
'help' => 'Passphrase help',
'required' => true,
'pattern' => '^.{16,}$',
'minlength' => '16',
'pattern' => '^.*[^ ] [^ ].*$',
],
],
],

View file

@ -242,6 +242,7 @@ class Edit extends Profile
if ($this->rules->rename) {
$fields['username'] = [
'type' => 'text',
'minlength' => $this->c->USERNAME['min'],
'maxlength' => $this->user->isAdmin ? '190' : $this->c->USERNAME['max'],
'caption' => 'Username',
'required' => true,

View file

@ -231,7 +231,7 @@ class Email extends Profile
'maxlength' => (string) $this->c->MAX_EMAIL_LENGTH,
'caption' => $this->rules->confirmEmail ? 'New or old email' : 'New email',
'required' => true,
'pattern' => '.+@.+',
'pattern' => '^.*[^@]@[^@].*$',
'value' => $this->curUser->email,
'help' => $this->rules->my ? 'Email instructions' : null,
'autocapitalize' => 'off',

View file

@ -108,7 +108,8 @@ class Pass extends Profile
'type' => 'password',
'caption' => 'New pass',
'required' => true,
'pattern' => '^.{16,}$',
'minlength' => '16',
'pattern' => '^.*[^ ] [^ ].*$',
'help' => 'Passphrase help',
],
'password' => [

View file

@ -179,7 +179,7 @@ class Register extends Page
'caption' => 'Email',
'help' => 1 === $this->c->config->b_regs_verify ? 'Email help2' : 'Email help',
'required' => true,
'pattern' => '.+@.+',
'pattern' => '^.*[^@]@[^@].*$',
'autocapitalize' => 'off',
];
}
@ -187,6 +187,7 @@ class Register extends Page
$fields['username'] = [
'class' => ['hint'],
'type' => 'text',
'minlength' => $this->c->USERNAME['min'],
'maxlength' => $this->c->USERNAME['max'],
'value' => $v->username ?? ($this->useOAuth ? $this->nameGenerator($this->provider) : ''),
'caption' => 'Username',
@ -202,7 +203,8 @@ class Register extends Page
'caption' => 'Passphrase',
'help' => 'Passphrase help',
'required' => true,
'pattern' => '^.{16,}$',
'minlength' => '16',
'pattern' => '^.*[^ ] [^ ].*$',
];
}

View file

@ -171,6 +171,7 @@ class Search extends Page
'keywords' => [
'class' => ['w0'],
'type' => 'text',
'minlength' => '3',
'maxlength' => '100',
'caption' => 'Keyword search',
'value' => $v->keywords ?? '',
@ -209,6 +210,7 @@ class Search extends Page
'keywords' => [
'class' => ['w2'],
'type' => 'text',
'minlength' => '3',
'maxlength' => '100',
'caption' => 'Keyword search',
'value' => $v->keywords ?? '',

View file

@ -36,7 +36,7 @@
@case ('number')
@case ('password')
@case ('file')
<input id="id-{{ $key }}" name="{{ $key }}" class="f-ctrl" type="{{ $cur['type'] }}" @foreach ($cur as $k => $v) @if (\in_array($k, ['autofocus', 'disabled', 'multiple', 'readonly', 'required'], true) && ! empty($v)) {!! $k !!} @elseif (\in_array($k, ['accept', 'autocapitalize', 'autocomplete', 'max', 'maxlength', 'min', 'pattern', 'placeholder', 'step', 'title', 'value'], true)) {!! $k !!}="{{ $v }}" @endif @endforeach>
<input id="id-{{ $key }}" name="{{ $key }}" class="f-ctrl" type="{{ $cur['type'] }}" @foreach ($cur as $k => $v) @if (\in_array($k, ['autofocus', 'disabled', 'multiple', 'readonly', 'required'], true) && ! empty($v)) {!! $k !!} @elseif (\in_array($k, ['accept', 'autocapitalize', 'autocomplete', 'max', 'maxlength', 'min', 'minlength', 'pattern', 'placeholder', 'step', 'title', 'value'], true)) {!! $k !!}="{{ $v }}" @endif @endforeach>
@break
@case ('textarea')
<textarea id="id-{{ $key }}" name="{{ $key }}" class="f-ctrl f-ytxtarea" @foreach ($cur as $k => $v) @if (\in_array($k, ['autofocus', 'disabled', 'readonly', 'required'], true) && ! empty($v)) {!! $k !!} @elseif (\in_array($k, ['maxlength', 'placeholder', 'rows', 'title'], true)) {!! $k !!}="{{ $v }}" @elseif ('data' === $k) @foreach ($v as $kd => $vd) data-{{ $kd }}="{{ $vd }}" @endforeach @endif @endforeach>{{ $cur['value'] or '' }}</textarea>

View file

@ -819,6 +819,10 @@ body,
border: 0.0625rem solid #AA7939;
}
#fork input.f-ctrl:user-invalid {
border: 0.125rem dotted red;
}
#fork input:focus,
#fork select:focus,
#fork textarea:focus {