|
@@ -13,8 +13,20 @@ if (!empty($_SESSION['loggedin']) && $_SESSION['loggedin'] === true && !isset($_
|
13
|
13
|
die();
|
14
|
14
|
}
|
15
|
15
|
|
16
|
|
-if (!empty($_GET['logout'])) {
|
17
|
|
- // Show a logout message instead of immediately redirecting to login flow
|
|
16
|
+
|
|
17
|
+/**
|
|
18
|
+ * Show a simple HTML page with a line of text and a button. Matches the UI of
|
|
19
|
+ * the AccountHub login flow.
|
|
20
|
+ *
|
|
21
|
+ * @global type $SETTINGS
|
|
22
|
+ * @global type $SECURE_NONCE
|
|
23
|
+ * @global type $Strings
|
|
24
|
+ * @param string $title Text to show, passed through i18n
|
|
25
|
+ * @param string $button Button text, passed through i18n
|
|
26
|
+ * @param string $url URL for the button
|
|
27
|
+ */
|
|
28
|
+function showHTML(string $title, string $button, string $url) {
|
|
29
|
+ global $SETTINGS, $SECURE_NONCE, $Strings;
|
18
|
30
|
?>
|
19
|
31
|
<!DOCTYPE html>
|
20
|
32
|
<meta charset="UTF-8">
|
|
@@ -26,8 +38,20 @@ if (!empty($_GET['logout'])) {
|
26
|
38
|
<link rel="icon" href="static/img/logo.svg">
|
27
|
39
|
|
28
|
40
|
<link href="static/css/bootstrap.min.css" rel="stylesheet">
|
29
|
|
- <link href="static/css/svg-with-js.min.css" rel="stylesheet">
|
30
|
|
- <link href="static/css/login.css" rel="stylesheet">
|
|
41
|
+ <style nonce="<?php echo $SECURE_NONCE; ?>">
|
|
42
|
+ .display-5 {
|
|
43
|
+ font-size: 2.5rem;
|
|
44
|
+ font-weight: 300;
|
|
45
|
+ line-height: 1.2;
|
|
46
|
+ }
|
|
47
|
+
|
|
48
|
+ .banner-image {
|
|
49
|
+ max-height: 100px;
|
|
50
|
+ margin: 2em auto;
|
|
51
|
+ border: 1px solid grey;
|
|
52
|
+ border-radius: 15%;
|
|
53
|
+ }
|
|
54
|
+ </style>
|
31
|
55
|
|
32
|
56
|
<div class="container mt-4">
|
33
|
57
|
<div class="row justify-content-center">
|
|
@@ -36,24 +60,25 @@ if (!empty($_GET['logout'])) {
|
36
|
60
|
</div>
|
37
|
61
|
|
38
|
62
|
<div class="col-12 text-center">
|
39
|
|
- <h1 class="display-5 mb-4"><?php $Strings->get("You have been logged out.") ?></h1>
|
|
63
|
+ <h1 class="display-5 mb-4"><?php $Strings->get($title); ?></h1>
|
40
|
64
|
</div>
|
41
|
65
|
|
42
|
66
|
<div class="col-12 col-sm-8 col-lg-6">
|
43
|
67
|
<div class="card mt-4">
|
44
|
68
|
<div class="card-body">
|
45
|
|
- <a href="./index.php" class="btn btn-primary btn-block"><?php $Strings->get("Log in again"); ?></a>
|
|
69
|
+ <a href="<?php echo $url; ?>" class="btn btn-primary btn-block"><?php $Strings->get($button); ?></a>
|
46
|
70
|
</div>
|
47
|
71
|
</div>
|
48
|
72
|
</div>
|
49
|
73
|
</div>
|
50
|
74
|
</div>
|
51
|
|
-
|
52
|
|
- <script src="static/js/fontawesome-all.min.js"></script>
|
53
|
75
|
<?php
|
54
|
|
- die();
|
55
|
76
|
}
|
56
|
77
|
|
|
78
|
+if (!empty($_GET['logout'])) {
|
|
79
|
+ showHTML("You have been logged out.", "Log in again", "./index.php");
|
|
80
|
+ die();
|
|
81
|
+}
|
57
|
82
|
if (empty($_SESSION["login_code"])) {
|
58
|
83
|
$redirecttologin = true;
|
59
|
84
|
} else {
|
|
@@ -64,7 +89,8 @@ if (empty($_SESSION["login_code"])) {
|
64
|
89
|
Session::start($user);
|
65
|
90
|
$_SESSION["login_code"] = null;
|
66
|
91
|
header('Location: app.php');
|
67
|
|
- die("Logged in, go to app.php");
|
|
92
|
+ showHTML("Logged in", "Continue", "./app.php");
|
|
93
|
+ die();
|
68
|
94
|
} catch (Exception $ex) {
|
69
|
95
|
$redirecttologin = true;
|
70
|
96
|
}
|
|
@@ -76,8 +102,12 @@ if ($redirecttologin) {
|
76
|
102
|
|
77
|
103
|
$_SESSION["login_code"] = $code;
|
78
|
104
|
|
79
|
|
- header("Location: ./login/?code=" . htmlentities($code) . "&redirect=" . htmlentities($_SERVER["REQUEST_URI"]));
|
|
105
|
+ $loginurl = "./login/?code=" . htmlentities($code) . "&redirect=" . htmlentities($_SERVER["REQUEST_URI"]);
|
|
106
|
+
|
|
107
|
+ header("Location: $loginurl");
|
|
108
|
+ showHTML("Continue", "Continue", $loginurl);
|
|
109
|
+ die();
|
80
|
110
|
} catch (Exception $ex) {
|
81
|
111
|
sendError($ex->getMessage());
|
82
|
112
|
}
|
83
|
|
-}
|
|
113
|
+}
|