Cleanup + Login View

This commit is contained in:
2022-02-21 14:04:49 +01:00
parent f46705cd84
commit 872ef4099a
21 changed files with 54 additions and 799 deletions

View File

@@ -40,6 +40,9 @@ class Account extends TemplateDocument {
} else if (!$settings->isRegistrationAllowed()) {
$this->createError("Registration is not enabled on this website.");
}
} else if ($this->getTemplateName() === "account/login.twig" && $this->user->isLoggedIn()) {
header("Location: /admin");
exit();
} else if ($this->getTemplateName() === "account/accept_invite.twig") {
if (isset($_GET["token"]) && is_string($_GET["token"]) && !empty($_GET["token"])) {
$this->parameters["view"]["token"] = $_GET["token"];

View File

@@ -1,65 +0,0 @@
<?php
namespace Documents {
use Documents\Files\FilesBody;
use Documents\Files\FilesHead;
use Elements\Document;
use Objects\User;
class Files extends Document {
public function __construct(User $user, string $view = NULL) {
parent::__construct($user, FilesHead::class, FilesBody::class, $view);
}
}
}
namespace Documents\Files {
use Elements\Head;
use Elements\Link;
use Elements\Script;
use Elements\SimpleBody;
class FilesHead extends Head {
protected function initSources() {
$this->addCSS(Link::BOOTSTRAP);
$this->loadFontawesome();
}
protected function initMetas(): array {
return array(
array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0'),
array('name' => 'format-detection', 'content' => 'telephone=yes'),
array('charset' => 'utf-8'),
array('http-equiv' => 'expires', 'content' => '0'),
array('name' => 'robots', 'content' => 'noarchive'),
array('name' => 'referrer', 'content' => 'origin')
);
}
protected function initRawFields(): array {
return array();
}
protected function initTitle(): string {
return "File Control Panel";
}
}
class FilesBody extends SimpleBody {
public function __construct($document) {
parent::__construct($document);
}
protected function getContent(): string {
$html = "<noscript>" . $this->createErrorText("Javascript is required for this site to render.") . "</noscript>";
$html .= "<div id=\"root\"></div>";
$html .= new Script(Script::MIME_TEXT_JAVASCRIPT, Script::FILES);
return $html;
}
}
}