New bootstrap-based layout #30

Merged
Roflin merged 79 commits from bootstrap into master 2023-03-14 19:11:25 +01:00
3 changed files with 67 additions and 45 deletions
Showing only changes of commit 2d1a299fe0 - Show all commits

View File

@ -11,19 +11,25 @@ class ForgotPasswordForm extends SubTemplate
protected function html_content()
{
echo '
<div class="boxed_content">
<h2>Password reset procedure</h2>';
<h1>Password reset procedure</h1>';
foreach ($this->_subtemplates as $template)
$template->html_main();
echo '
<p>Please fill in the email address you used to sign up in the form below. You will be sent a reset link to your email address.</p>
<form class="form-horizontal" action="', BASEURL, '/resetpassword/?step=1" method="post">
<label class="control-label" for="field_emailaddress">E-mail address:</label><br>
<input type="text" id="field_emailaddress" name="emailaddress">
<p class="mt-3">Please fill in the email address you used to sign up in the form below. We will send a reset link to your email address.</p>
<form action="', BASEURL, '/resetpassword/?step=1" method="post">
<div class="row">
<label class="col-sm-2 col-form-label" for="field_emailaddress">E-mail address:</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="field_emailaddress" name="emailaddress">
</div>
</div>
<div class="row mt-3">
<div class="offset-sm-2 col-sm-2">
<button type="submit" class="btn btn-primary">Send mail</button>
</form>
</div>';
</div>
</div>
</form>';
}
}

View File

@ -11,34 +11,44 @@ class LogInForm extends SubTemplate
private $redirect_url = '';
private $emailaddress = '';
protected $_class = 'content-box container w-50';
public function setRedirectUrl($url)
{
$_SESSION['login_url'] = $url;
$this->redirect_url = $url;
}
public function setEmail($addr)
{
$this->emailaddress = htmlentities($addr);
$this->emailaddress = htmlspecialchars($addr);
}
protected function html_content()
{
if (!empty($this->_title))
echo '
<form action="', BASEURL, '/login/" method="post" id="login">
<h3>Log in</h3>';
<h1 class="mb-4">Log in to your account</h1>';
if (!empty($this->_subtemplates))
{
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>';
<form class="mt-4" action="', BASEURL, '/login/" method="post">
<div class="row">
<label class="col-sm-3 col-form-label" for="field_emailaddress">E-mail address:</label>
<div class="col-sm">
<input type="text" class="form-control" id="field_emailaddress" name="emailaddress" value="', $this->emailaddress, '">
</div>
</div>
<div class="row mt-3">
<label class="col-sm-3 col-form-label" for="field_password">Password:</label>
<div class="col-sm">
<input type="password" class="form-control" id="field_password" name="password">
</div>
</div>';
// Throw in a redirect url if asked for.
if (!empty($this->redirect_url))
@ -46,9 +56,11 @@ class LogInForm extends SubTemplate
<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 class="mt-4">
<div class="offset-sm-3 col-sm-9">
<button type="submit" class="btn btn-primary">Sign in</button>
<a class="btn btn-light" href="', BASEURL, '/resetpassword/" style="margin-left: 1em">Forgotten your password?</a>
</div>
</div>
</form>';
}

View File

@ -20,27 +20,31 @@ class PasswordResetForm extends SubTemplate
protected function html_content()
{
echo '
<div class="boxed_content">
<h2>Password reset procedure</h2>';
<h1 class="mb-4">Password reset procedure</h1>';
foreach ($this->_subtemplates as $template)
$template->html_main();
echo '
<p>You have successfully confirmed your identify. Please use the form below to set a new password.</p>
<form class="form-horizontal" action="', BASEURL, '/resetpassword/?step=2&amp;email=', rawurlencode($this->email), '&amp;key=', $this->key, '" method="post">
<p>
<label class="control-label" for="field_password1">New password:</label>
<input type="password" id="field_password1" name="password1">
</p>
<p>
<label class="control-label" for="field_password2">Repeat new password:</label>
<input type="password" id="field_password2" name="password2">
</p>
<form action="', BASEURL, '/resetpassword/?step=2&amp;email=', rawurlencode($this->email), '&amp;key=', $this->key, '" method="post">
<div class="row mt-3">
<label class="col-sm-2 col-form-label" for="field_password1">New password:</label>
<div class="col-sm-3">
<input type="password" class="form-control" id="field_password1" name="password1">
</div>
</div>
<div class="row mt-3">
<label class="col-sm-2 col-form-label" for="field_password2">Repeat new password:</label>
<div class="col-sm-3">
<input type="password" class="form-control" id="field_password2" name="password2">
</div>
</div>
<div class="row mt-3">
<div class="offset-sm-2 col-sm-2">
<button type="submit" class="btn btn-primary">Reset password</button>
</form>
</div>';
</div>
</div>
</form>';
}
}