-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpasswordless.php
More file actions
77 lines (72 loc) · 2.56 KB
/
passwordless.php
File metadata and controls
77 lines (72 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/**
* Includes
*/
require 'vendor/autoload.php';
require_once 'config.php';
require_once "LoginController.php";
$loginController = new LoginController($rublon_cfg);
/* user is logged-in */
if (!empty($_SESSION['user'])) {
/* user wants to logout */
if (!empty($_GET['action']) && $_GET['action'] === 'logout') {
unset($_SESSION['user']);
header('Location: passwordless.php');
}
} else if (!empty($_POST['action']) && $_POST['action'] === 'passwordless') {
/* user is trying to login */
$rublonLoginBox = $loginController->passwordlessLogin();
header('Location: passwordless.php');
}
?>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<script type="text/javascript" src="validator.js"></script>
</head>
<body>
<nav class="navbar">
<div class="container">
<div class="row">
<div class="col-4 logo-container">
<img src="Rublon-favicon-128.png" class="mr-3 logo">
<a href="passwordless.php">Rublon Example</a>
</div>
<div class="col-4"></div>
<div class="col-4 align-right">
<?php
if (!empty($_SESSION['user'])) {
?>
<a href="?action=logout" class="nav-link"><i class="fas fa-sign-out-alt"></i> Logout</a>
<?php
} else {
?>
<a href="index.php" class="nav-link"><i class="fas fa-sign-in-alt"></i> Switch to 2factor login</a>
<?php
}
?>
</div>
</div>
</div>
</nav>
<?php
include('flashmsg.php');
/* user is logged-in */
if (!empty($_SESSION['user'])) {
/* show restricted page */
include 'home.php';
} else {
/* show widget */
$rublonLoginBox = $loginController->renderWidget();
?>
<div id="rublonLoginBox">
<?php
echo $rublonLoginBox['rublonLoginBox'];
?>
</div>
<?php
}
?>
</body>