Skip to content

Commit 41f319b

Browse files
authored
Merge pull request #852 from kenjis/docs-validation_rules.md
docs: update validation rules
2 parents 425a550 + 9dd0068 commit 41f319b

1 file changed

Lines changed: 20 additions & 7 deletions

File tree

docs/customization/validation_rules.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Registration
44

5-
Shield has the following rules for registration:
5+
Shield has the following rules for registration by default:
66

77
```php
88
[
@@ -27,7 +27,10 @@ Shield has the following rules for registration:
2727
],
2828
'password' => [
2929
'label' => 'Auth.password',
30-
'rules' => 'required|strong_password',
30+
'rules' => 'required|max_byte[72]|strong_password[]',
31+
'errors' => [
32+
'max_byte' => 'Auth.errorPasswordTooLongBytes'
33+
]
3134
],
3235
'password_confirm' => [
3336
'label' => 'Auth.passwordConfirm',
@@ -70,7 +73,10 @@ If you need a different set of rules for registration, you can specify them in y
7073
],
7174
'password' => [
7275
'label' => 'Auth.password',
73-
'rules' => 'required|strong_password',
76+
'rules' => 'required|max_byte[72]|strong_password[]',
77+
'errors' => [
78+
'max_byte' => 'Auth.errorPasswordTooLongBytes'
79+
]
7480
],
7581
'password_confirm' => [
7682
'label' => 'Auth.passwordConfirm',
@@ -97,12 +103,19 @@ Similar to the process for validation rules in the **Registration** section, you
97103
// 'rules' => 'required|max_length[30]|min_length[3]|regex_match[/\A[a-zA-Z0-9\.]+\z/]',
98104
// ],
99105
'email' => [
100-
'label' => 'Auth.email',
101-
'rules' => 'required|max_length[254]|valid_email',
106+
'label' => 'Auth.email',
107+
'rules' => [
108+
'required',
109+
'max_length[254]',
110+
'valid_email'
111+
],
102112
],
103113
'password' => [
104-
'label' => 'Auth.password',
105-
'rules' => 'required',
114+
'label' => 'Auth.password',
115+
'rules' => 'required|max_byte[72]',
116+
'errors' => [
117+
'max_byte' => 'Auth.errorPasswordTooLongBytes',
118+
]
106119
],
107120
];
108121
```

0 commit comments

Comments
 (0)