File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ protected function getValidationRules(): array
6565 {
6666 return setting ('Validation.login ' ) ?? [
6767 //'username' => setting('Validation._username') ?? $this->getUsernameRules(),
68- 'email ' => ' required|max_length[254]|valid_email ' ,
68+ 'email ' => $ this -> getEmailRules () ,
6969 'password ' => 'required ' ,
7070 ];
7171 }
@@ -85,6 +85,20 @@ public static function getUsernameRules(): array
8585 ];
8686 }
8787
88+ /**
89+ * Returns the validation rules for email
90+ *
91+ * @return string[]
92+ */
93+ public static function getEmailRules (): array
94+ {
95+ return [
96+ 'required ' ,
97+ 'max_length[254] ' ,
98+ 'valid_email ' ,
99+ ];
100+ }
101+
88102 /**
89103 * Logs the current user out.
90104 */
Original file line number Diff line number Diff line change @@ -186,12 +186,12 @@ private function recordLoginAttempt(
186186 /**
187187 * Returns the rules that should be used for validation.
188188 *
189- * @return array<string, string>
189+ * @return array<string, array< string, string> >
190190 */
191191 protected function getValidationRules (): array
192192 {
193193 return [
194- 'email ' => ' required|max_length[254]|valid_email ' ,
194+ 'email ' => LoginController:: getEmailRules () ,
195195 ];
196196 }
197197}
Original file line number Diff line number Diff line change @@ -136,10 +136,14 @@ protected function getValidationRules(): array
136136 $ usernameRules ,
137137 ['is_unique[users.username] ' ]
138138 );
139+ $ registrationEmailRules = array_merge (
140+ LoginController::getEmailRules (),
141+ ['is_unique[auth_identities.secret] ' ]
142+ );
139143
140144 return setting ('Validation.registration ' ) ?? [
141145 'username ' => $ registrationUsernameRules ,
142- 'email ' => ' required|valid_email|is_unique[auth_identities.secret] ' ,
146+ 'email ' => $ registrationEmailRules ,
143147 'password ' => 'required|strong_password ' ,
144148 'password_confirm ' => 'required|matches[password] ' ,
145149 ];
You can’t perform that action at this time.
0 commit comments