diff --git a/api/actions/getloginkey.php b/api/actions/getloginkey.php index 166b488..fba5caa 100644 --- a/api/actions/getloginkey.php +++ b/api/actions/getloginkey.php @@ -6,7 +6,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -$code = LoginKey::generate($VARS['appname']); +$appicon = null; +if (!empty($VARS['appicon'])) { + $appicon = $VARS['appicon']; +} + +$code = LoginKey::generate($VARS['appname'], $appicon); if (strpos($SETTINGS['url'], "http") === 0) { $url = $SETTINGS['url'] . "login/"; diff --git a/api/apisettings.php b/api/apisettings.php index 043b339..0b2767a 100644 --- a/api/apisettings.php +++ b/api/apisettings.php @@ -215,7 +215,8 @@ $APIS = [ "getloginkey" => [ "load" => "getloginkey.php", "vars" => [ - "appname" => "string" + "appname" => "string", + "appicon (optional)" => "string" ] ], "checkloginkey" => [ diff --git a/database.mwb b/database.mwb index 9479ae4..0697751 100644 Binary files a/database.mwb and b/database.mwb differ diff --git a/database_upgrade/2.1_3.0.sql b/database_upgrade/2.1_3.0.sql index 0992672..df8ac61 100644 --- a/database_upgrade/2.1_3.0.sql +++ b/database_upgrade/2.1_3.0.sql @@ -25,4 +25,5 @@ ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; ALTER TABLE `userloginkeys` -ADD COLUMN `appname` VARCHAR(255) NOT NULL AFTER `uid`; \ No newline at end of file +ADD COLUMN `appname` VARCHAR(255) NOT NULL AFTER `uid`; +ADD COLUMN `appicon` TINYTEXT NULL DEFAULT NULL AFTER `appname`; \ No newline at end of file diff --git a/index.php b/index.php index a922a89..40ba621 100644 --- a/index.php +++ b/index.php @@ -26,16 +26,14 @@ if (!empty($_GET['logout'])) { - +
+
+ +
+

get("You have been logged out.") ?>

@@ -73,7 +71,7 @@ if (empty($_SESSION["login_code"])) { if ($redirecttologin) { try { - $code = LoginKey::generate($SETTINGS["site_title"]); + $code = LoginKey::generate($SETTINGS["site_title"], "../static/img/logo.svg"); $_SESSION["login_code"] = $code; diff --git a/lib/LoginKeys.lib.php b/lib/LoginKeys.lib.php index d445568..3990cc5 100644 --- a/lib/LoginKeys.lib.php +++ b/lib/LoginKeys.lib.php @@ -8,13 +8,13 @@ class LoginKey { - public static function generate(string $appname): string { + public static function generate(string $appname, $appicon = null): string { global $database; do { $code = base64_encode(random_bytes(32)); } while ($database->has('userloginkeys', ['key' => $code])); - $database->insert('userloginkeys', ['key' => $code, 'expires' => date("Y-m-d H:i:s", time() + 600), 'appname' => $appname]); + $database->insert('userloginkeys', ['key' => $code, 'expires' => date("Y-m-d H:i:s", time() + 600), 'appname' => $appname, 'appicon' => $appicon]); return $code; } diff --git a/login/index.php b/login/index.php index 2aaca5d..afd8921 100644 --- a/login/index.php +++ b/login/index.php @@ -21,7 +21,9 @@ if (!$database->has("userloginkeys", ["AND" => ["key" => $_GET["code"]], "expire die("Invalid auth code."); } -$APPNAME = $database->get("userloginkeys", "appname", ["key" => $_GET["code"]]); +$APPINFO = $database->get("userloginkeys", ["appname", "appicon"], ["key" => $_GET["code"]]); +$APPNAME = $APPINFO["appname"]; +$APPICON = $APPINFO["appicon"]; if (empty($_SESSION['thisstep'])) { $_SESSION['thisstep'] = "username"; diff --git a/login/parts/header.php b/login/parts/header.php index edf11e6..ec980a5 100644 --- a/login/parts/header.php +++ b/login/parts/header.php @@ -26,6 +26,21 @@ header("Link: <../static/js/fontawesome-all.min.js>; rel=preload; as=script", fa
+ +
+ +
+ +
+
+
+

build("Login to {app}", ["app" => htmlentities($APPNAME)]); ?>

diff --git a/static/css/login.css b/static/css/login.css index 8b68a67..020bcb6 100644 --- a/static/css/login.css +++ b/static/css/login.css @@ -5,7 +5,19 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/. */ .display-5 { - font-size: 3rem; + font-size: 2.5rem; font-weight: 300; line-height: 1.2; +} + +.banner-image { + max-height: 100px; + margin: 2em auto; + border: 1px solid grey; + border-radius: 15%; +} + +.blank-image { + height: 100px; + margin: 2em auto; } \ No newline at end of file