Frontend, Bugfixes
This commit is contained in:
@@ -5,12 +5,12 @@ namespace Documents {
|
||||
use Documents\Admin\AdminHead;
|
||||
use Elements\Document;
|
||||
use Objects\User;
|
||||
use Views\AdminDashboard;
|
||||
use Views\Admin\AdminDashboardBody;
|
||||
use Views\LoginBody;
|
||||
|
||||
class Admin extends Document {
|
||||
public function __construct(User $user) {
|
||||
$body = $user->isLoggedIn() ? AdminDashboard::class : LoginBody::class;
|
||||
$body = $user->isLoggedIn() ? AdminDashboardBody::class : LoginBody::class;
|
||||
parent::__construct($user, AdminHead::class, $body);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Documents\Document404 {
|
||||
|
||||
use Elements\Body;
|
||||
use Elements\Head;
|
||||
use Views\View404;
|
||||
|
||||
class Head404 extends Head {
|
||||
|
||||
@@ -25,11 +26,6 @@ namespace Documents\Document404 {
|
||||
}
|
||||
|
||||
protected function initSources() {
|
||||
// $this->loadJQuery();
|
||||
// $this->loadBootstrap();
|
||||
// $this->loadFontawesome();
|
||||
// $this->addJS(\Elements\Script::CORE);
|
||||
// $this->addCSS(\Elements\Link::CORE);
|
||||
}
|
||||
|
||||
protected function initMetas() {
|
||||
@@ -59,7 +55,7 @@ namespace Documents\Document404 {
|
||||
|
||||
public function getCode() {
|
||||
$html = parent::getCode();
|
||||
$html .= "<b>404 Not Found</b>";
|
||||
$html .= "<body>" . (new View404($this->getDocument())) . "</body>";
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Documents {
|
||||
namespace Documents\Install {
|
||||
|
||||
use Api\Notifications\Create;
|
||||
use Api\Parameter\Parameter;
|
||||
use Configuration\CreateDatabase;
|
||||
use Driver\SQL\SQL;
|
||||
use Elements\Body;
|
||||
@@ -289,8 +290,8 @@ namespace Documents\Install {
|
||||
$username = $this->getParameter("username");
|
||||
$password = $this->getParameter("password");
|
||||
$confirmPassword = $this->getParameter("confirmPassword");
|
||||
$email = $this->getParameter("email") ?? "";
|
||||
|
||||
$msg = $this->errorString;
|
||||
$success = true;
|
||||
$missingInputs = array();
|
||||
|
||||
@@ -321,13 +322,16 @@ namespace Documents\Install {
|
||||
} else if(strlen($password) < 6) {
|
||||
$msg = "The password should be at least 6 characters long";
|
||||
$success = false;
|
||||
} else if($email && Parameter::parseType($email) !== Parameter::TYPE_EMAIL) {
|
||||
$msg = "Invalid email address";
|
||||
$success = false;
|
||||
} else {
|
||||
$salt = generateRandomString(16);
|
||||
$hash = hash('sha256', $password . $salt);
|
||||
$sql = $user->getSQL();
|
||||
|
||||
$success = $sql->insert("User", array("name", "salt", "password"))
|
||||
->addRow($username, $salt, $hash)
|
||||
$success = $sql->insert("User", array("name", "salt", "password", "email"))
|
||||
->addRow($username, $salt, $hash, $email)
|
||||
->returning("uid")
|
||||
->execute()
|
||||
&& $sql->insert("UserGroup", array("group_id", "user_id"))
|
||||
@@ -606,6 +610,7 @@ namespace Documents\Install {
|
||||
"title" => "Create a User",
|
||||
"form" => array(
|
||||
array("title" => "Username", "name" => "username", "type" => "text", "required" => true),
|
||||
array("title" => "Email", "name" => "email", "type" => "text"),
|
||||
array("title" => "Password", "name" => "password", "type" => "password", "required" => true),
|
||||
array("title" => "Confirm Password", "name" => "confirmPassword", "type" => "password", "required" => true),
|
||||
),
|
||||
@@ -704,7 +709,7 @@ namespace Documents\Install {
|
||||
$id = $button["id"];
|
||||
$float = $button["float"];
|
||||
$disabled = (isset($button["disabled"]) && $button["disabled"]) ? " disabled" : "";
|
||||
$button = "<button type=\"button\" id=\"$id\" class=\"btn btn-$type margin-xs\"$disabled>$title</button>";
|
||||
$button = "<button type=\"button\" id=\"$id\" class=\"btn btn-$type m-1\"$disabled>$title</button>";
|
||||
|
||||
if($float === "left") {
|
||||
$buttonsLeft .= $button;
|
||||
|
||||
Reference in New Issue
Block a user