File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77use App \Controllers \BaseController ;
88use CodeIgniter \HTTP \RedirectResponse ;
99use CodeIgniter \Shield \Authentication \Authenticators \Session ;
10- use CodeIgniter \Shield \Authentication \Passwords ;
1110use CodeIgniter \Shield \Traits \Viewable ;
11+ use CodeIgniter \Shield \Validation \ValidationRules ;
1212
1313class LoginController extends BaseController
1414{
@@ -82,17 +82,9 @@ public function loginAction(): RedirectResponse
8282 */
8383 protected function getValidationRules (): array
8484 {
85- return setting ('Validation.login ' ) ?? [
86- // 'username' => config('Auth')->usernameValidationRules,
87- 'email ' => config ('Auth ' )->emailValidationRules ,
88- 'password ' => [
89- 'label ' => 'Auth.password ' ,
90- 'rules ' => 'required| ' . Passwords::getMaxLengthRule (),
91- 'errors ' => [
92- 'max_byte ' => 'Auth.errorPasswordTooLongBytes ' ,
93- ],
94- ],
95- ];
85+ $ rules = new ValidationRules ();
86+
87+ return $ rules ->getLoginRules ();
9688 }
9789
9890 /**
Original file line number Diff line number Diff line change @@ -49,6 +49,17 @@ public function getRegistrationRules(): array
4949 ];
5050 }
5151
52+ public function getLoginRules (): array
53+ {
54+ helper ('setting ' );
55+
56+ return setting ('Validation.login ' ) ?? [
57+ // 'username' => $this->config->usernameValidationRules,
58+ 'email ' => $ this ->config ->emailValidationRules ,
59+ 'password ' => $ this ->getPasswordRules (),
60+ ];
61+ }
62+
5263 public function getPasswordRules (): array
5364 {
5465 return [
You can’t perform that action at this time.
0 commit comments