Replies: 13 comments 5 replies
-
Oh, I used my own written routes instead of the single line statement specified in the documentation. The code is shown below: $routes->group('auth', ['namespace' => 'App\Controllers'], static function ($routes) {
$routes->get('login', 'AuthController::loginPage');
$routes->post('login', 'AuthController::loginAction');
}); |
Beta Was this translation helpful? Give feedback.
-
Check your login form. Does it send a POST request to |
Beta Was this translation helpful? Give feedback.
-
Yes it does here is the code: <?= form_open('auth/login') ?>
<?php if (session('error') !== null) : ?>
<div class="alert alert-danger" role="alert"><?= session('error') ?></div>
<?php elseif (session('errors') !== null) : ?>
<div class="alert alert-danger" role="alert">
<?php if (is_array(session('errors'))) : ?>
<?php foreach (session('errors') as $error) : ?>
<?= $error ?>
<br>
<?php endforeach ?>
<?php else : ?>
<?= session('errors') ?>
<?php endif ?>
</div>
<?php endif ?>
<div class="input-group mb-3">
<input type="text" name="username" value="<?= old('username') ?>" class="form-control" placeholder="Username" autocomplete="off" required />
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-user-circle"></span>
</div>
</div>
</div>
<div class="input-group mb-3">
<input type="password"name="password" class="form-control" placeholder="Password" autocomplete="off" required />
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-lock"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-8">
<div class="form-check icheck-primary">
<input id="rememberMe" type="checkbox" name="remember" class="form-check-input" <?php if (old('remember')): ?> checked<?php endif ?> />
<label for="rememberMe" class="form-check-label">Remember Me</label>
</div>
</div>
<div class="col-4">
<button type="submit" class="btn btn-primary btn-block btn-flat">
<span class="fas fa-sign-in-alt mr-1"></span>
Login
</button>
</div>
</div>
<?= form_close() ?> |
Beta Was this translation helpful? Give feedback.
-
If you send a POST request to I don't know why a POST request is not sent, but I believe this is not a bug in Shield. Check the HTTP requests with your browser developer tool. |
Beta Was this translation helpful? Give feedback.
-
Okay. Let me take a closer look into it. Will update you on the proceedings once am done. Thanks anyway. :) |
Beta Was this translation helpful? Give feedback.
-
What kenjis mentioned, I don't consider this a bug. The minimum code provided by you was not complete, with a little change, the code works. I consider this issue over. Therefore, I will send the topic to the discussion section. |
Beta Was this translation helpful? Give feedback.
-
If you confirm a POST request to |
Beta Was this translation helpful? Give feedback.
-
I have formatted my machine. Hopefully this will solve my problem. |
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
@datamweb What changes did you have to make to the provided code to make it work? That will probably help @Elvis254 out. |
Beta Was this translation helpful? Give feedback.
-
Hi, Please run php spark env development&php spark serve see localhost:8080/auth/login and send screenshot? |
Beta Was this translation helpful? Give feedback.
-
To identify if CSRF filtering is the cause, you can disable CSRF filtering (it is disabled by default): And if you need to use CSRF filter (probably you always should use it), |
Beta Was this translation helpful? Give feedback.
-
Thanks. I will look into it once the first release is out. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
PHP Version
8.1.6.0
CodeIgniter4 Version
4.2.11
Shield Version
dev-develop 44bbf2c
Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
MySQL 5.6
Did you customize Shield?
I customized the Login Controller where I need to create an admin panel and it needs no registration process maybe on another Controller so as to have the super admin create, read, update & delete users as per required. I also copied the code in the Register Controller into another file that runs during software installation. In that when the software is installing a super admin is added to the system without having them fill out forms about their details so their information is hard coded in the software.
What happened?
When I try to login into the system it does nothing but returns me to the login form.
Steps to Reproduce
I have included the codes I used to customize the software below. It doesn't even show the Log Message in the login action method.
The code I used to add a super admin to the system is shown below.
Expected Output
I expect it to get me logged in and redirect me to the dashboard page of the system.
Anything else?
No response
Beta Was this translation helpful? Give feedback.
All reactions