File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -215,7 +215,7 @@ class LoginController extends BaseController
215215 return setting('Validation.login') ?? [
216216 'email' => [
217217 'label' => 'Auth.email',
218- 'rules' => config(AuthSession::class )->emailValidationRules,
218+ 'rules' => config('Auth' )->emailValidationRules,
219219 ],
220220 'password' => [
221221 'label' => 'Auth.password',
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class LoginController extends BaseController
2626 $rules = setting('Validation.login') ?? [
2727 'email' => [
2828 'label' => 'Auth.email',
29- 'rules' => config('AuthSession ')->emailValidationRules,
29+ 'rules' => config('Auth ')->emailValidationRules,
3030 ],
3131 'password' => [
3232 'label' => 'Auth.password',
Original file line number Diff line number Diff line change @@ -224,6 +224,33 @@ class Auth extends BaseConfig
224224 'rememberLength ' => 30 * DAY ,
225225 ];
226226
227+ /**
228+ * --------------------------------------------------------------------
229+ * The validation rules for username
230+ * --------------------------------------------------------------------
231+ *
232+ * @var string[]
233+ */
234+ public array $ usernameValidationRules = [
235+ 'required ' ,
236+ 'max_length[30] ' ,
237+ 'min_length[3] ' ,
238+ 'regex_match[/\A[a-zA-Z0-9\.]+\z/] ' ,
239+ ];
240+
241+ /**
242+ * --------------------------------------------------------------------
243+ * The validation rules for email
244+ * --------------------------------------------------------------------
245+ *
246+ * @var string[]
247+ */
248+ public array $ emailValidationRules = [
249+ 'required ' ,
250+ 'max_length[254] ' ,
251+ 'valid_email ' ,
252+ ];
253+
227254 /**
228255 * --------------------------------------------------------------------
229256 * Minimum Password Length
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ class AuthSession extends BaseConfig
1515 * The validation rules for username
1616 *
1717 * @var string[]
18+ *
19+ * @deprecated Moved to Auth. No longer used.
1820 */
1921 public array $ usernameValidationRules = [
2022 'required ' ,
@@ -27,6 +29,8 @@ class AuthSession extends BaseConfig
2729 * The validation rules for email
2830 *
2931 * @var string[]
32+ *
33+ * @deprecated Moved to Auth. No longer used.
3034 */
3135 public array $ emailValidationRules = [
3236 'required ' ,
Original file line number Diff line number Diff line change @@ -85,11 +85,11 @@ protected function getValidationRules(): array
8585 return setting ('Validation.login ' ) ?? [
8686 // 'username' => [
8787 // 'label' => 'Auth.username',
88- // 'rules' => config('AuthSession ')->usernameValidationRules,
88+ // 'rules' => config('Auth ')->usernameValidationRules,
8989 // ],
9090 'email ' => [
9191 'label ' => 'Auth.email ' ,
92- 'rules ' => config ('AuthSession ' )->emailValidationRules ,
92+ 'rules ' => config ('Auth ' )->emailValidationRules ,
9393 ],
9494 'password ' => [
9595 'label ' => 'Auth.password ' ,
Original file line number Diff line number Diff line change @@ -236,7 +236,7 @@ protected function getValidationRules(): array
236236 return [
237237 'email ' => [
238238 'label ' => 'Auth.email ' ,
239- 'rules ' => config ('AuthSession ' )->emailValidationRules ,
239+ 'rules ' => config ('Auth ' )->emailValidationRules ,
240240 ],
241241 ];
242242 }
Original file line number Diff line number Diff line change @@ -24,11 +24,11 @@ public function __construct()
2424 public function get (): array
2525 {
2626 $ registrationUsernameRules = array_merge (
27- config ('AuthSession ' )->usernameValidationRules ,
27+ config ('Auth ' )->usernameValidationRules ,
2828 [sprintf ('is_unique[%s.username] ' , $ this ->tables ['users ' ])]
2929 );
3030 $ registrationEmailRules = array_merge (
31- config ('AuthSession ' )->emailValidationRules ,
31+ config ('Auth ' )->emailValidationRules ,
3232 [sprintf ('is_unique[%s.secret] ' , $ this ->tables ['identities ' ])]
3333 );
3434
Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ public function testLoginActionUsernameSuccess(): void
183183 'password ' => 'required ' ,
184184 ];
185185 };
186- $ config ->login ['username ' ] = config ('AuthSession ' )->usernameValidationRules ;
186+ $ config ->login ['username ' ] = config ('Auth ' )->usernameValidationRules ;
187187 Factories::injectMock ('config ' , 'Validation ' , $ config );
188188
189189 $ this ->user ->createEmailIdentity ([
You can’t perform that action at this time.
0 commit comments