fix redirect page

This commit is contained in:
root
2026-04-18 11:06:31 -04:00
parent f04934039e
commit 189bb1a628
5 changed files with 96 additions and 28 deletions
+2 -1
View File
@@ -25,6 +25,7 @@
<br>
<input type="hidden" name="selected_role" id="selected_role">
<input type="hidden" name="redirect_to" value="<?= esc((string) ($redirect_to ?? '')) ?>">
<div class="d-flex flex-wrap justify-content-center gap-3 mt-3">
<?php foreach ($roles as $role): ?>
@@ -68,4 +69,4 @@
tooltipTriggerList.forEach(el => new bootstrap.Tooltip(el));
});
</script>
<?= $this->endSection() ?>
<?= $this->endSection() ?>
+4 -19
View File
@@ -1,25 +1,10 @@
<?php
use CodeIgniter\Exceptions\PageNotFoundException;
if (!function_exists('base_url')) {
throw new PageNotFoundException('base_url function not found');
}
$session = session();
if ($session->get('isLoggedIn')) {
header('Location: ' . base_url('/dashboard'));
exit();
}
?>
<?= $this->extend('layout/register_layout') ?>
<?= $this->section('content') ?>
<div class="registration-form container mt-5 mb-5">
<form id="loginForm" method="post" action="<?= base_url('/user/login') ?>">
<?= csrf_field() ?>
<input type="hidden" name="redirect_to" value="<?= esc(old('redirect_to', $redirect_to ?? '')) ?>">
<div class="text-center mb-4">
<a href="<?= base_url('/') ?>">
<img src="<?= base_url('assets/images/alrahma_logo.png') ?>" alt=""
@@ -60,9 +45,9 @@ if ($session->get('isLoggedIn')) {
<button type="submit" class="btn btn-success item">Login</button>
</div>
<!-- Flash Error Message -->
<?php if ($session->getFlashdata('error')): ?>
<?php if (session()->getFlashdata('error')): ?>
<div class="alert alert-danger mt-3 text-center" role="alert">
<?= esc($session->getFlashdata('error')) ?>
<?= esc(session()->getFlashdata('error')) ?>
</div>
<?php endif; ?>
<!-- Forgot Password -->
@@ -125,4 +110,4 @@ if ($session->get('isLoggedIn')) {
}
});
</script>
<?= $this->endSection() ?>
<?= $this->endSection() ?>