Skip to content

Commit 4851a59

Browse files
authored
Merge pull request #873 from kenjis/docs-jwt-LoginController
docs: update sample LoginController for JWT
2 parents 09a7cf3 + a8b48ca commit 4851a59

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

docs/addons/jwt.md

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ use CodeIgniter\API\ResponseTrait;
150150
use CodeIgniter\HTTP\ResponseInterface;
151151
use CodeIgniter\Shield\Authentication\Authenticators\Session;
152152
use CodeIgniter\Shield\Authentication\JWTManager;
153-
use CodeIgniter\Shield\Authentication\Passwords;
154-
use CodeIgniter\Shield\Config\AuthSession;
153+
use CodeIgniter\Shield\Validation\ValidationRules;
155154

156155
class LoginController extends BaseController
157156
{
@@ -215,19 +214,9 @@ class LoginController extends BaseController
215214
*/
216215
protected function getValidationRules(): array
217216
{
218-
return setting('Validation.login') ?? [
219-
'email' => [
220-
'label' => 'Auth.email',
221-
'rules' => config('Auth')->emailValidationRules,
222-
],
223-
'password' => [
224-
'label' => 'Auth.password',
225-
'rules' => 'required|' . Passwords::getMaxLengthRule(),
226-
'errors' => [
227-
'max_byte' => 'Auth.errorPasswordTooLongBytes',
228-
],
229-
],
230-
];
217+
$rules = new ValidationRules();
218+
219+
return $rules->getLoginRules();
231220
}
232221
}
233222
```

0 commit comments

Comments
 (0)