public function login() { $errors = false; if (!empty($_POST)) { $auth = new DBAuth(App::getInstance()->getDb()); if ($auth->login($_POST['username'], $_POST['password'])) { header('Location: index.php?page=admin.post.index'); } else { $errors = true; } } $form = new FoundationForm($_POST); $this->render('user.login', compact('form', 'errors')); }
public function login() { $errors = false; if (!empty($_POST)) { $auth = new DBAuth(App::getInstance()->getDb()); if ($auth->login($_POST['username'], $_POST['password'])) { header('Location: index.php?page=admin.articles.index'); } else { var_dump($this->Users); $errors = true; var_dump($this->Users); } } $form = new BootstrapForm($_POST); $this->render('users.login', compact('form', 'errors')); }
<?php use Core\HTML\DafstyleForm; use Core\Auth\DBAuth; if (!empty($_POST)) { $auth = new DBAuth(App::getInstance()->getDb()); if ($auth->login($_POST['username'], $_POST['password'])) { header('Location:admin.php'); } else { ?> <div class="alert alert-warm">Identifiant ou mot de passe incorrect.</div><?php } } $form = new DafstyleForm($_POST); ?> <div class="daf-gr-ctnr"> <div class="daf-sct-10"> <div class="alert titro">Connexion au back-office</div> <form method="post"> <?php echo $form->input('username', 'Nom d\'utilisateur'); ?> <?php echo $form->input('password', 'Mot de passe', ['type' => 'password']); ?> <button class="btn btn-primary">Connexion</button> </form> </div> </div>