Add login page.

This commit is contained in:
2011-12-19 15:05:47 +00:00
parent f3f98eb000
commit a850ed911d
2 changed files with 47 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?php
$main = StatusBoard_Main::instance();
$request = $main->request();
$auth = $main->auth();
$authenticated = false;
$authentication_failed = false;
if ($request->exists('do')) {
$username = StatusBoard_Main::issetelse($_POST['username'], Sihnon_Exception_InvalidParameters);
$password = StatusBoard_Main::issetelse($_POST['username'], Sihnon_Exception_InvalidParameters);
try {
$auth->authenticate($username, $password);
$authenticated = true;
StatusBoard_Page::redirect('home');
} catch (Sihnon_Exception_UnknownUser $e) {
$authentication_failed = true;
} catch (Sihnon_Exception_IncorrectPassword $e) {
$authentication_failed = true;
}
}
$this->smarty->assign('authentication', $authenticated);
$this->smarty->assign('authentication_failed', $authentication_failed);
?>

View File

@@ -0,0 +1,17 @@
{if $authentication_failed}
<div class="data-alert">
Incorrect username/password combination entered.
</div>
{/if}
<form id="page_login" method="post" action="{$base_uri}login/do/">
<label for="page_username">Username</label>
<input id="page_username" type="text" name="username" />
<label for="page_password">Password</label>
<input id="page_password" type="password" name="password" />
<input id="page_login" type="submit" class="success" />
</form>