2020-02-10 00:52:25 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Views;
|
|
|
|
|
2020-04-03 22:10:21 +02:00
|
|
|
use Elements\Body;
|
|
|
|
|
|
|
|
class LoginBody extends Body {
|
2020-04-03 15:56:04 +02:00
|
|
|
|
2020-02-10 00:52:25 +01:00
|
|
|
public function __construct($document) {
|
|
|
|
parent::__construct($document);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCode() {
|
2020-04-03 22:10:21 +02:00
|
|
|
|
|
|
|
$this->getDocument()->getHead()->loadBootstrap();
|
2020-02-10 00:52:25 +01:00
|
|
|
|
|
|
|
$username = L("Username");
|
|
|
|
$password = L("Password");
|
|
|
|
$login = L("Login");
|
|
|
|
$backToStartPage = L("Back to Start Page");
|
2020-04-03 22:10:21 +02:00
|
|
|
$stayLoggedIn = L("Stay logged in");
|
|
|
|
|
2020-02-10 00:52:25 +01:00
|
|
|
$flags = new LanguageFlags($this->getDocument());
|
2020-04-03 22:10:21 +02:00
|
|
|
$iconBack = $this->createIcon("arrow-circle-left");
|
2020-02-10 00:52:25 +01:00
|
|
|
$domain = $_SERVER['HTTP_HOST'];
|
|
|
|
$protocol = getProtocol();
|
|
|
|
|
2020-04-03 22:10:21 +02:00
|
|
|
$html = "<body>";
|
|
|
|
|
2020-02-10 00:52:25 +01:00
|
|
|
$accountCreated = "";
|
|
|
|
if(isset($_GET["accountCreated"])) {
|
2020-04-03 22:10:21 +02:00
|
|
|
$accountCreated =
|
|
|
|
'<div class="alert alert-success mt-3" id="accountCreated">
|
2020-02-10 00:52:25 +01:00
|
|
|
Your account was successfully created, you may now login with your credentials
|
|
|
|
</div>';
|
|
|
|
}
|
|
|
|
|
2020-04-03 15:56:04 +02:00
|
|
|
$html .= "
|
2020-04-03 22:10:21 +02:00
|
|
|
<div class=\"container mt-4\">
|
2020-02-10 00:52:25 +01:00
|
|
|
<div class=\"title text-center\">
|
|
|
|
<h2>Admin Control Panel</h2>
|
|
|
|
</div>
|
2020-04-03 22:10:21 +02:00
|
|
|
<div class=\"loginContainer m-auto\">
|
2020-02-10 00:52:25 +01:00
|
|
|
<form class=\"loginForm\">
|
|
|
|
<label for=\"username\">$username</label>
|
|
|
|
<input type=\"text\" class=\"form-control\" name=\"username\" id=\"username\" placeholder=\"$username\" required autofocus />
|
|
|
|
<label for=\"password\">$password</label>
|
|
|
|
<input type=\"password\" class=\"form-control\" name=\"password\" id=\"password\" placeholder=\"$password\" required />
|
2020-04-03 22:10:21 +02:00
|
|
|
<div class=\"form-check\">
|
|
|
|
<input type=\"checkbox\" class=\"form-check-input\" id=\"stayLoggedIn\" name=\"stayLoggedIn\">
|
|
|
|
<label class=\"form-check-label\" for=\"stayLoggedIn\">$stayLoggedIn</label>
|
|
|
|
</div>
|
2020-02-10 00:52:25 +01:00
|
|
|
<button class=\"btn btn-lg btn-primary btn-block\" id=\"btnLogin\" type=\"button\">$login</button>
|
|
|
|
<div class=\"alert alert-danger hidden\" role=\"alert\" id=\"loginError\"></div>
|
2020-04-03 22:10:21 +02:00
|
|
|
<span class=\"flags position-absolute\">$flags</span>
|
2020-02-10 00:52:25 +01:00
|
|
|
</form>
|
2020-04-03 22:10:21 +02:00
|
|
|
<div class=\"p-1\">
|
|
|
|
<a href=\"$protocol://$domain\">$iconBack $backToStartPage</a>
|
|
|
|
</div>
|
2020-02-10 00:52:25 +01:00
|
|
|
$accountCreated
|
|
|
|
</div>
|
2020-04-03 22:10:21 +02:00
|
|
|
</div>
|
|
|
|
</body>";
|
2020-02-10 00:52:25 +01:00
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
}
|