Skip to content

login with username #323

Answered by datamweb
paul45 asked this question in Q&A
Jul 27, 2022 · 2 comments · 4 replies
Discussion options

You must be logged in to vote

Yes, you can.

  1. Edit file app/Config/Auth.php
    public array $views = [
        'login'                       => '\App\Views\Shield\login',
    ];

and comment email and uncomment username:

    /**
     * --------------------------------------------------------------------
     * Valid login fields
     * --------------------------------------------------------------------
     * Fields that are available to be used as credentials for login.
     */
    public array $validFields = [
        //'email',
        'username',
    ];
  1. copy file vendor\codeigniter4\shield\src\Views\login.php to app\Views\Shield\login.php and edit :
<!-- Email -->
<div class="mb-2">
     <input type="text" class

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@paul45
Comment options

@paul45
Comment options

@kenjis
Comment options

Answer selected by kenjis
Comment options

You must be logged in to vote
1 reply
@datamweb
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants