From 27dd4c29c0202ce3fe76e4a9d18ff6aa7ddeb132 Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel
Date: Wed, 29 Apr 2009 07:40:07 +0200
Subject: [PATCH] Add a very basic login view.
---
koward/lib/Koward/Controller/LoginController.php | 53 ++++++++++++++++++++++++
koward/lib/Koward/View/Login/login.html.php | 28 +++++++++++++
2 files changed, 81 insertions(+)
create mode 100644 koward/lib/Koward/Controller/LoginController.php
create mode 100644 koward/lib/Koward/View/Login/login.html.php
diff --git a/koward/lib/Koward/Controller/LoginController.php b/koward/lib/Koward/Controller/LoginController.php
new file mode 100644
index 000000000..0fbe30de8
--- /dev/null
+++ b/koward/lib/Koward/Controller/LoginController.php
@@ -0,0 +1,53 @@
+urlFor(array('controller' => 'index')));
+ exit;
+ }
+
+ $this->title = _("Login");
+ $this->welcome = _("Welcome.");
+
+ $this->post = $this->urlFor(array('controller' => 'login',
+ 'action' => 'login'));
+
+ if (isset($_POST['horde_user']) && isset($_POST['horde_pass'])) {
+ /* Destroy any existing session on login and make sure to use a
+ * new session ID, to avoid session fixation issues. */
+ Horde::getCleanSession();
+ if ($this->koward->auth->authenticate(Util::getPost('horde_user'),
+ array('password' => Util::getPost('horde_pass')))) {
+ $entry = sprintf('Login success for %s [%s] to Horde',
+ Auth::getAuth(), $_SERVER['REMOTE_ADDR']);
+ Horde::logMessage($entry, __FILE__, __LINE__, PEAR_LOG_NOTICE);
+
+ header('Location: ' . $this->urlFor(array('controller' => 'index')));
+ exit;
+ } else {
+ $entry = sprintf('FAILED LOGIN for %s [%s] to Horde',
+ Util::getFormData('horde_user'), $_SERVER['REMOTE_ADDR']);
+ Horde::logMessage($entry, __FILE__, __LINE__, PEAR_LOG_ERR);
+ }
+ }
+
+ if ($reason = $this->koward->auth->getLogoutReasonString()) {
+ $this->koward->notification->push(str_replace('
', ' ', $reason), 'horde.message');
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/koward/lib/Koward/View/Login/login.html.php b/koward/lib/Koward/View/Login/login.html.php
new file mode 100644
index 000000000..48dc91c5f
--- /dev/null
+++ b/koward/lib/Koward/View/Login/login.html.php
@@ -0,0 +1,28 @@
+= $this->renderPartial('header'); ?>
+
+