--- /dev/null
+<?php
+/**
+ * @package Koward
+ */
+
+/**
+ * @package Koward
+ */
+class LoginController extends Koward_Controller_Application
+{
+ protected $welcome;
+
+ protected $auth_handler = true;
+
+ public function login()
+ {
+ $auth = Auth::getAuth();
+ if (!empty($auth)) {
+ header('Location: ' . $this->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('<br />', ' ', $reason), 'horde.message');
+ }
+
+ }
+}
\ No newline at end of file
--- /dev/null
+<?= $this->renderPartial('header'); ?>
+
+<div id="menu">
+ <h1 style="text-align:center"><?= $this->welcome ?></h1>
+</div>
+
+<?php $this->koward->notification->notify(array('listeners' => 'status')) ?>
+
+<form name="koward_login" method="post" action="<?= $this->post ?>"
+<table width="100%"><tr><td align="center"><table width="300" align="center">
+
+<tr>
+ <td class="light rightAlign"><strong><?php echo Horde::label('horde_user', _("Username")) ?></strong> </td>
+ <td class="leftAlign"><input type="text" id="horde_user" name="horde_user" value="<?php echo htmlspecialchars(Util::getFormData('horde_user')) ?>" style="direction:ltr" /></td>
+</tr>
+
+<tr>
+ <td class="light rightAlign"><strong><?php echo Horde::label('horde_pass', _("Password")) ?></strong> </td>
+ <td class="leftAlign"><input type="password" id="horde_pass" name="horde_pass" value="" style="direction:ltr" /></td>
+</tr>
+
+<tr>
+ <td> </td>
+ <td class="light leftAlign"><input name="loginButton" class="button" value="<?php echo _("Log in") ?>" type="submit" onclick="return submit_login();" /></td>
+</tr>
+
+</table></td></tr></table>
+</form>