Authentication module in framework
This commit is contained in:
parent
f40eb92e68
commit
e8cdfe9d64
Binary file not shown.
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Sealandia\Core\Template;
|
||||||
|
use Sealandia\Core\Auth;
|
||||||
|
|
||||||
|
class Login{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Authenticate the given credentials
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function authenticate($username, $password){
|
||||||
|
$auth = new Auth();
|
||||||
|
$auth->login($username, $password);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the application login page.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function index(){
|
||||||
|
if(isset($_POST['submit'])){
|
||||||
|
$this->authenticate($_POST['email'], $_POST['password']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$template = new Template();
|
||||||
|
return $template->render('login', []);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?php
|
||||||
|
$db_config = [
|
||||||
|
"DB_HOST" => "",
|
||||||
|
"DB_NAME" => "",
|
||||||
|
"DB_USERNAME" => "",
|
||||||
|
"DB_PASSWORD" => ""
|
||||||
|
]
|
||||||
|
?>
|
|
@ -4,6 +4,7 @@ namespace Sealandia;
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
|
require_once __DIR__ . '/config.php';
|
||||||
require_once __DIR__ . '/vendor/autoload.php';
|
require_once __DIR__ . '/vendor/autoload.php';
|
||||||
require __DIR__ . '/routes/routes.php';
|
require __DIR__ . '/routes/routes.php';
|
||||||
?>
|
?>
|
|
@ -4,6 +4,7 @@ use Sealandia\Core\Router;
|
||||||
|
|
||||||
$routes = [
|
$routes = [
|
||||||
'/' => 'Welcome@index',
|
'/' => 'Welcome@index',
|
||||||
|
'/login' => 'Login@index'
|
||||||
];
|
];
|
||||||
|
|
||||||
$router = (new Router)->routeToController($routes);
|
$router = (new Router)->routeToController($routes);
|
|
@ -0,0 +1,3 @@
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,11 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Sealandia framework</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" type="text/css" href="../assets/style.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php include('includes/header.php'); ?>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">Login</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<form method="POST">
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="email" class="col-md-4 col-form-label text-md-end">E-mailadres</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="email" type="email" class="form-control" name="email" required autocomplete="email" autofocus>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label for="password" class="col-md-4 col-form-label text-md-end">Wachtwoord</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="password" type="password" class="form-control" name="password" required autocomplete="current-password">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-0">
|
||||||
|
<div class="col-md-8 offset-md-4">
|
||||||
|
<button type="submit" name="submit" class="btn btn-primary">
|
||||||
|
Inloggen
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php include('includes/footer.php'); ?>
|
|
@ -1,12 +1,5 @@
|
||||||
<html>
|
<?php include('includes/header.php'); ?>
|
||||||
<head>
|
|
||||||
<title>Sealandia framework</title>
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
|
|
||||||
<link rel="stylesheet" type="text/css" href="../assets/style.css" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="background">
|
<div class="background">
|
||||||
<div class="welcome_wrapper">
|
<div class="welcome_wrapper">
|
||||||
<div class="welcome_content">
|
<div class="welcome_content">
|
||||||
|
@ -68,5 +61,5 @@
|
||||||
<span class="bulb"></span>
|
<span class="bulb"></span>
|
||||||
<span class="bulb"></span>
|
<span class="bulb"></span>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
|
||||||
</html>
|
<?php include('includes/footer.php'); ?>
|
Loading…
Reference in New Issue