From b39147daf43b76713ecd475e1538073c0e2a1cda Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Mon, 7 May 2012 01:57:29 +0200 Subject: [PATCH] Login page --- frontend/css/cvm.css | 18 +++++++++++ frontend/module.login.php | 56 +++++++++++++++++++++++++++++++++ frontend/module.logout.php | 29 +++++++++++++++++ frontend/rewrite.php | 2 +- frontend/templates/login.tpl | 18 +++++++++++ frontend/templates/main.tpl | 1 - frontend/templates/main.vps.tpl | 6 ++-- 7 files changed, 125 insertions(+), 5 deletions(-) create mode 100644 frontend/module.login.php create mode 100644 frontend/module.logout.php create mode 100644 frontend/templates/login.tpl diff --git a/frontend/css/cvm.css b/frontend/css/cvm.css index 3362d8c..0c03dbd 100644 --- a/frontend/css/cvm.css +++ b/frontend/css/cvm.css @@ -424,3 +424,21 @@ table.vpslist tr:hover margin: 0px; padding-left: 24px; } + + +input +{ + padding: 4px 6px; +} + +input, label +{ + margin-top: 0px !important; + margin-bottom: 0px !important; +} + +button.column +{ + margin-left: 1.6% !important; + margin-right: 1.6% !important; +} diff --git a/frontend/module.login.php b/frontend/module.login.php new file mode 100644 index 0000000..8538190 --- /dev/null +++ b/frontend/module.login.php @@ -0,0 +1,56 @@ +VerifyPassword($_POST['password'])) + { + $_SESSION['userid'] = $sLoginUser->sId; + header("Location: /"); + die(); + } + else + { + $err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_ERROR, "Login failed", "The login details you provided are invalid. Please try again."); + $sError .= $err->Render(); + } + } + else + { + $err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_ERROR, "Login failed", "The login details you provided are invalid. Please try again."); + $sError .= $err->Render(); + } +} + +$sMainContents = Templater::InlineRender("login", $locale->strings, array( + 'error' => $sError, + 'field-username' => $sFieldUsername +)); diff --git a/frontend/module.logout.php b/frontend/module.logout.php new file mode 100644 index 0000000..37c20da --- /dev/null +++ b/frontend/module.logout.php @@ -0,0 +1,29 @@ +Render(); +} +else +{ + $err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_ERROR, "You are not logged in", "You can only logout when you are already logged in."); + $sMainContents .= $err->Render(); +} diff --git a/frontend/rewrite.php b/frontend/rewrite.php index fc2546a..fa7f597 100644 --- a/frontend/rewrite.php +++ b/frontend/rewrite.php @@ -16,7 +16,7 @@ require("includes/include.base.php"); $sTemplateParameters = array(); -$_SESSION['userid'] = 1; +//$_SESSION['userid'] = 1; if(!empty($_SESSION['userid'])) { diff --git a/frontend/templates/login.tpl b/frontend/templates/login.tpl new file mode 100644 index 0000000..3c489ac --- /dev/null +++ b/frontend/templates/login.tpl @@ -0,0 +1,18 @@ +

Login to your VPS panel

+ +<%?error> + +
+
+ + +
+ +
+ + +
+ +
+ +
diff --git a/frontend/templates/main.tpl b/frontend/templates/main.tpl index 8fca7dc..7c39fbb 100644 --- a/frontend/templates/main.tpl +++ b/frontend/templates/main.tpl @@ -5,7 +5,6 @@ - diff --git a/frontend/templates/main.vps.tpl b/frontend/templates/main.vps.tpl index 3cd3e84..1b11432 100644 --- a/frontend/templates/main.vps.tpl +++ b/frontend/templates/main.vps.tpl @@ -2,11 +2,11 @@ Overview Statistics Reinstall - Backups + WebShell IP Allocation - Alerts - API + <%?error>