pics/templates/LogInForm.php
Aaron van Geffen 7487068171 Allow resetting password through email.
This also adopts the use of an Alert template for error and success messages.
2017-11-09 17:00:34 +01:00

56 lines
1.6 KiB
PHP

<?php
/*****************************************************************************
* LogInForm.php
* Contains the login form template.
*
* Kabuki CMS (C) 2013-2015, Aaron van Geffen
*****************************************************************************/
class LogInForm extends SubTemplate
{
private $redirect_url = '';
private $emailaddress = '';
public function setRedirectUrl($url)
{
$_SESSION['login_url'] = $url;
$this->redirect_url = $url;
}
public function setEmail($addr)
{
$this->emailaddress = htmlentities($addr);
}
protected function html_content()
{
echo '
<form action="', BASEURL, '/login/" method="post" id="login">
<h3>Log in</h3>';
foreach ($this->_subtemplates as $template)
$template->html_main();
echo '
<dl>
<dt><label for="field_emailaddress">E-mail address:</label></dt>
<dd><input type="text" id="field_emailaddress" name="emailaddress" tabindex="1" value="', $this->emailaddress, '" autofocus></dd>
<dt><label for="field_password">Password:</label></dt>
<dd><input type="password" id="field_password" name="password" tabindex="2"></dd>
</dl>';
// Throw in a redirect url if asked for.
if (!empty($this->redirect_url))
echo '
<input type="hidden" name="redirect_url" value="', base64_encode($this->redirect_url), '">';
echo '
<a href="', BASEURL, '/resetpassword/">Forgotten your password?</a>
<div class="buttonstrip">
<button type="submit" class="btn btn-primary" id="field_login" name="login" tabindex="3">Log in</button>
</div>
</form>';
}
}