Add login page.
This commit is contained in:
30
source/webui/pages/login.php
Normal file
30
source/webui/pages/login.php
Normal 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);
|
||||||
|
|
||||||
|
?>
|
||||||
17
source/webui/templates/login.tpl
Normal file
17
source/webui/templates/login.tpl
Normal 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>
|
||||||
Reference in New Issue
Block a user