@@ -47,41 +47,41 @@ Shield has the following rules for registration by default:
4747If you need a different set of rules for registration, you can specify them in your ` Validation ` configuration (** app/Config/Validation.php** ) like:
4848
4949``` php
50- //--------------------------------------------------------------------
51- // Rules For Registration
52- //--------------------------------------------------------------------
53- public $registration = [
54- 'username' => [
55- 'label' => 'Auth.username',
56- 'rules' => [
57- 'required',
58- 'max_length[30]',
59- 'min_length[3]',
60- 'regex_match[/\A[a-zA-Z0-9\.]+\z/]',
61- 'is_unique[users.username]',
62- ],
63- ],
64- 'email' => [
65- 'label' => 'Auth.email',
66- 'rules' => [
67- 'required',
68- 'max_length[254]',
69- 'valid_email',
70- 'is_unique[auth_identities.secret]',
71- ],
72- ],
73- 'password' => [
74- 'label' => 'Auth.password',
75- 'rules' => 'required|max_byte[72]|strong_password[]',
76- 'errors' => [
77- 'max_byte' => 'Auth.errorPasswordTooLongBytes'
78- ]
50+ //--------------------------------------------------------------------
51+ // Rules For Registration
52+ //--------------------------------------------------------------------
53+ public $registration = [
54+ 'username' => [
55+ 'label' => 'Auth.username',
56+ 'rules' => [
57+ 'required',
58+ 'max_length[30]',
59+ 'min_length[3]',
60+ 'regex_match[/\A[a-zA-Z0-9\.]+\z/]',
61+ 'is_unique[users.username]',
7962 ],
80- 'password_confirm' => [
81- 'label' => 'Auth.passwordConfirm',
82- 'rules' => 'required|matches[password]',
63+ ],
64+ 'email' => [
65+ 'label' => 'Auth.email',
66+ 'rules' => [
67+ 'required',
68+ 'max_length[254]',
69+ 'valid_email',
70+ 'is_unique[auth_identities.secret]',
8371 ],
84- ];
72+ ],
73+ 'password' => [
74+ 'label' => 'Auth.password',
75+ 'rules' => 'required|max_byte[72]|strong_password[]',
76+ 'errors' => [
77+ 'max_byte' => 'Auth.errorPasswordTooLongBytes'
78+ ]
79+ ],
80+ 'password_confirm' => [
81+ 'label' => 'Auth.passwordConfirm',
82+ 'rules' => 'required|matches[password]',
83+ ],
84+ ];
8585```
8686
8787!!! note
@@ -93,28 +93,28 @@ If you need a different set of rules for registration, you can specify them in y
9393Similar to the process for validation rules in the ** Registration** section, you can add rules for the login form to ** app/Config/Validation.php** and change the rules.
9494
9595``` php
96- //--------------------------------------------------------------------
97- // Rules For Login
98- //--------------------------------------------------------------------
99- public $login = [
100- // 'username' => [
101- // 'label' => 'Auth.username',
102- // 'rules' => 'required|max_length[30]|min_length[3]|regex_match[/\A[a-zA-Z0-9\.]+\z/]',
103- // ],
104- 'email' => [
105- 'label' => 'Auth.email',
106- 'rules' => [
107- 'required',
108- 'max_length[254]',
109- 'valid_email'
110- ],
111- ],
112- 'password' => [
113- 'label' => 'Auth.password',
114- 'rules' => 'required|max_byte[72]',
115- 'errors' => [
116- 'max_byte' => 'Auth.errorPasswordTooLongBytes',
117- ]
96+ //--------------------------------------------------------------------
97+ // Rules For Login
98+ //--------------------------------------------------------------------
99+ public $login = [
100+ // 'username' => [
101+ // 'label' => 'Auth.username',
102+ // 'rules' => 'required|max_length[30]|min_length[3]|regex_match[/\A[a-zA-Z0-9\.]+\z/]',
103+ // ],
104+ 'email' => [
105+ 'label' => 'Auth.email',
106+ 'rules' => [
107+ 'required',
108+ 'max_length[254]',
109+ 'valid_email'
118110 ],
119- ];
111+ ],
112+ 'password' => [
113+ 'label' => 'Auth.password',
114+ 'rules' => 'required|max_byte[72]',
115+ 'errors' => [
116+ 'max_byte' => 'Auth.errorPasswordTooLongBytes',
117+ ]
118+ ],
119+ ];
120120```
0 commit comments