mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-18 03:00:56 +01:00
various updates
This commit is contained in:
@@ -176,8 +176,6 @@ class AdminPlugin extends Plugin
|
|||||||
$page = new Page;
|
$page = new Page;
|
||||||
$page->init(new \SplFileInfo(__DIR__ . "/pages/admin/{$self->template}.md"));
|
$page->init(new \SplFileInfo(__DIR__ . "/pages/admin/{$self->template}.md"));
|
||||||
$page->slug(basename($self->template));
|
$page->slug(basename($self->template));
|
||||||
$page->extension('.md');
|
|
||||||
|
|
||||||
return $page;
|
return $page;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,10 +120,12 @@ class AdminController
|
|||||||
*/
|
*/
|
||||||
protected function taskLogin()
|
protected function taskLogin()
|
||||||
{
|
{
|
||||||
|
$l = $this->grav['language'];
|
||||||
|
|
||||||
if ($this->admin->authenticate($this->post)) {
|
if ($this->admin->authenticate($this->post)) {
|
||||||
$this->admin->setMessage('You have been logged in.');
|
$this->admin->setMessage($l->translate('LOGIN_LOGGED_IN'));
|
||||||
} else {
|
} else {
|
||||||
$this->admin->setMessage('Login failed.');
|
$this->admin->setMessage($l->translate('LOGIN_FAILED'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -136,8 +138,10 @@ class AdminController
|
|||||||
*/
|
*/
|
||||||
protected function taskLogout()
|
protected function taskLogout()
|
||||||
{
|
{
|
||||||
|
$l = $this->grav['language'];
|
||||||
|
|
||||||
$this->admin->session()->invalidate()->start();
|
$this->admin->session()->invalidate()->start();
|
||||||
$this->admin->setMessage('You have been logged out.');
|
$this->admin->setMessage($l->translate('LOGGED_OUT'));
|
||||||
$this->setRedirect('/');
|
$this->setRedirect('/');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -145,25 +149,27 @@ class AdminController
|
|||||||
|
|
||||||
protected function taskForgot()
|
protected function taskForgot()
|
||||||
{
|
{
|
||||||
|
$l = $this->grav['language'];
|
||||||
|
|
||||||
$data = $this->post;
|
$data = $this->post;
|
||||||
|
|
||||||
$username = isset($data['username']) ? $data['username'] : '';
|
$username = isset($data['username']) ? $data['username'] : '';
|
||||||
$user = !empty($username) ? User::load($username) : null;
|
$user = !empty($username) ? User::load($username) : null;
|
||||||
|
|
||||||
if (!isset($this->grav['Email'])) {
|
if (!isset($this->grav['Email'])) {
|
||||||
$this->admin->setMessage('Cannot reset password. This site is not configured to send emails.');
|
$this->admin->setMessage($l->translate('FORGOT_EMAIL_NOT_CONFIGURED'));
|
||||||
$this->setRedirect('/');
|
$this->setRedirect('/');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user || !$user->exists()) {
|
if (!$user || !$user->exists()) {
|
||||||
$this->admin->setMessage('User with username \'' . $username . '\' does not exist.');
|
$this->admin->setMessage($l->translate(['FORGOT_USERNAME_DOES_NOT_EXIST', $username]));
|
||||||
$this->setRedirect('/forgot');
|
$this->setRedirect('/forgot');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($user->email)) {
|
if (empty($user->email)) {
|
||||||
$this->admin->setMessage('Cannot reset password for \'' . $username . '\', no email address is set.');
|
$this->admin->setMessage($l->translate(['FORGOT_CANNOT_RESET_EMAIL_NO_EMAIL', $username]));
|
||||||
$this->setRedirect('/forgot');
|
$this->setRedirect('/forgot');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -178,14 +184,14 @@ class AdminController
|
|||||||
$fullname = $user->fullname ?: $username;
|
$fullname = $user->fullname ?: $username;
|
||||||
$reset_link = rtrim($this->grav['uri']->rootUrl(true), '/') . '/' . trim($this->admin->base, '/') . '/reset/task:reset/user:' . $username . '/token:' . $token;
|
$reset_link = rtrim($this->grav['uri']->rootUrl(true), '/') . '/' . trim($this->admin->base, '/') . '/reset/task:reset/user:' . $username . '/token:' . $token;
|
||||||
|
|
||||||
$from = $this->grav['config']->get('site.author.email', 'noreply@getgrav.org');
|
$sitename = $this->grav['config']->get('site.title', 'Website');
|
||||||
|
$from = $this->grav['config']->get('plugins.email.from', 'noreply@getgrav.org');
|
||||||
$to = $user->email;
|
$to = $user->email;
|
||||||
$subject = $this->grav['config']->get('site.title', 'Website') . ' password reset';
|
|
||||||
$body = $this->grav['twig']->processString('{% include "email/reset.html.twig" %}', [
|
$subject = $l->translate(['FORGOT_EMAIL_SUBJECT', $sitename]);
|
||||||
'name' => $fullname,
|
$content = $l->translate(['FORGOT_EMAIL_BODY', $fullname, $reset_link, $author, $sitename]);
|
||||||
'author' => $author,
|
|
||||||
'reset_link' =>$reset_link
|
$body = $this->grav['twig']->processTemplate('email/base.html.twig', ['content' => $content]);
|
||||||
]);
|
|
||||||
|
|
||||||
$message = $this->grav['Email']->message($subject, $body, 'text/html')
|
$message = $this->grav['Email']->message($subject, $body, 'text/html')
|
||||||
->setFrom($from)
|
->setFrom($from)
|
||||||
@@ -194,9 +200,9 @@ class AdminController
|
|||||||
$sent = $this->grav['Email']->send($message);
|
$sent = $this->grav['Email']->send($message);
|
||||||
|
|
||||||
if ($sent < 1) {
|
if ($sent < 1) {
|
||||||
$this->admin->setMessage('Failed to email instructions, please try again later.');
|
$this->admin->setMessage($l->translate('FORGOT_FAILED_TO_EMAIL'));
|
||||||
} else {
|
} else {
|
||||||
$this->admin->setMessage('Instructions to reset your password have been sent by email.');
|
$this->admin->setMessage($l->translate(['FORGOT_INSTRUCTIONS_SENT_VIA_EMAIL', $to]));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setRedirect('/');
|
$this->setRedirect('/');
|
||||||
@@ -205,10 +211,11 @@ class AdminController
|
|||||||
|
|
||||||
public function taskReset()
|
public function taskReset()
|
||||||
{
|
{
|
||||||
|
$l = $this->grav['language'];
|
||||||
|
|
||||||
$data = $this->post;
|
$data = $this->post;
|
||||||
|
|
||||||
if (isset($data['password'])) {
|
if (isset($data['password'])) {
|
||||||
|
|
||||||
$username = isset($data['username']) ? $data['username'] : null;
|
$username = isset($data['username']) ? $data['username'] : null;
|
||||||
$user = !empty($username) ? User::load($username) : null;
|
$user = !empty($username) ? User::load($username) : null;
|
||||||
$password = isset($data['password']) ? $data['password'] : null;
|
$password = isset($data['password']) ? $data['password'] : null;
|
||||||
@@ -218,9 +225,8 @@ class AdminController
|
|||||||
list($good_token, $expire) = explode('::', $user->reset);
|
list($good_token, $expire) = explode('::', $user->reset);
|
||||||
|
|
||||||
if ($good_token === $token) {
|
if ($good_token === $token) {
|
||||||
|
|
||||||
if (time() > $expire) {
|
if (time() > $expire) {
|
||||||
$this->admin->setMessage('Reset link has expired, please try again.');
|
$this->admin->setMessage($l->translate('RESET_LINK_EXPIRED'));
|
||||||
$this->setRedirect('/forgot');
|
$this->setRedirect('/forgot');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -231,13 +237,13 @@ class AdminController
|
|||||||
$user->password = $password;
|
$user->password = $password;
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
$this->admin->setMessage('Password has been reset.');
|
$this->admin->setMessage($l->translate('RESET_PASSWORD_RESET'));
|
||||||
$this->setRedirect('/');
|
$this->setRedirect('/');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->admin->setMessage('Invalid reset link used, please try again.');
|
$this->admin->setMessage($l->translate('RESET_INVALID_LINK'));
|
||||||
$this->setRedirect('/forgot');
|
$this->setRedirect('/forgot');
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -246,7 +252,7 @@ class AdminController
|
|||||||
$token = $this->grav['uri']->param('token');
|
$token = $this->grav['uri']->param('token');
|
||||||
|
|
||||||
if (empty($user) || empty($token)) {
|
if (empty($user) || empty($token)) {
|
||||||
$this->admin->setMessage('Invalid reset link used, please try again.');
|
$this->admin->setMessage($l->translate('RESET_INVALID_LINK'));
|
||||||
$this->setRedirect('/forgot');
|
$this->setRedirect('/forgot');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
19
languages.yaml
Normal file
19
languages.yaml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
en:
|
||||||
|
EMAIL_FOOTER: <a href="http://getgrav.org">Powered by Grav</a> - The Modern Flat File CMS
|
||||||
|
LOGIN_BTN: Login
|
||||||
|
LOGIN_BTN_FORGOT: Forgot
|
||||||
|
LOGIN_BTN_RESET: Reset Password
|
||||||
|
LOGIN_BTN_SEND_INSTRUCTIONS: Send Reset Instructions
|
||||||
|
LOGIN_LOGGED_IN: You have been logged in
|
||||||
|
LOGIN_FAILED: Login failed
|
||||||
|
LOGGED_OUT: You have been logged out
|
||||||
|
RESET_LINK_EXPIRED: Reset link has expired, please try again
|
||||||
|
RESET_PASSWORD_RESET: Password has been reset
|
||||||
|
RESET_INVALID_LINK: Invalid reset link used, please try again
|
||||||
|
FORGOT_INSTRUCTIONS_SENT_VIA_EMAIL: Instructions to reset your password have been sent via email to %s
|
||||||
|
FORGOT_FAILED_TO_EMAIL: Failed to email instructions, please try again later
|
||||||
|
FORGOT_CANNOT_RESET_EMAIL_NO_EMAIL: Cannot reset password for %s, no email address is set
|
||||||
|
FORGOT_USERNAME_DOES_NOT_EXIST: User with username <b>%s</b> does not exist
|
||||||
|
FORGOT_EMAIL_NOT_CONFIGURED: Cannot reset password. This site is not configured to send emails
|
||||||
|
FORGOT_EMAIL_SUBJECT: %s Password Reset Request
|
||||||
|
FORGOT_EMAIL_BODY: <h1>Password Reset</h1><p>Dear %1$s,</p><p>A request was made on <b>%4$s</b> to reset your password.</p><p><br /><a href="%2$s" class="btn-primary">Click this to reset your password</a><br /><br /></p><p>Alternatively, copy the following URL into your browser's address bar:</p> <p>%2$s</p><p><br />Kind regards,<br /><br />%3$s</p>
|
||||||
@@ -1,11 +1,194 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
{% block head %}
|
<meta name="viewport" content="width=device-width" />
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
{% endblock %}
|
<title>Really Simple HTML Email Template</title>
|
||||||
|
<style>
|
||||||
|
/* -------------------------------------
|
||||||
|
GLOBAL
|
||||||
|
------------------------------------- */
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
|
||||||
|
font-size: 100%;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
img {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-webkit-text-size-adjust: none;
|
||||||
|
width: 100%!important;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
/* -------------------------------------
|
||||||
|
ELEMENTS
|
||||||
|
------------------------------------- */
|
||||||
|
a {
|
||||||
|
color: #348eda;
|
||||||
|
}
|
||||||
|
.btn-primary {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #FFF;
|
||||||
|
background-color: #348eda;
|
||||||
|
border: solid #348eda;
|
||||||
|
border-width: 10px 20px;
|
||||||
|
line-height: 2;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-right: 10px;
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 25px;
|
||||||
|
}
|
||||||
|
.btn-secondary {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #FFF;
|
||||||
|
background-color: #aaa;
|
||||||
|
border: solid #aaa;
|
||||||
|
border-width: 10px 20px;
|
||||||
|
line-height: 2;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-right: 10px;
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 25px;
|
||||||
|
}
|
||||||
|
.last {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.first {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
.padding {
|
||||||
|
padding: 10px 0;
|
||||||
|
}
|
||||||
|
/* -------------------------------------
|
||||||
|
BODY
|
||||||
|
------------------------------------- */
|
||||||
|
table.body-wrap {
|
||||||
|
width: 100%;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
table.body-wrap .container {
|
||||||
|
border: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
/* -------------------------------------
|
||||||
|
FOOTER
|
||||||
|
------------------------------------- */
|
||||||
|
table.footer-wrap {
|
||||||
|
width: 100%;
|
||||||
|
clear: both!important;
|
||||||
|
}
|
||||||
|
.footer-wrap .container p {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #666;
|
||||||
|
|
||||||
|
}
|
||||||
|
table.footer-wrap a {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
/* -------------------------------------
|
||||||
|
TYPOGRAPHY
|
||||||
|
------------------------------------- */
|
||||||
|
h1, h2, h3 {
|
||||||
|
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
||||||
|
color: #000;
|
||||||
|
margin: 40px 0 10px;
|
||||||
|
line-height: 1.2;
|
||||||
|
font-weight: 200;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
font-size: 36px;
|
||||||
|
}
|
||||||
|
h2 {
|
||||||
|
font-size: 28px;
|
||||||
|
}
|
||||||
|
h3 {
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
p, ul, ol {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
font-weight: normal;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
ul li, ol li {
|
||||||
|
margin-left: 5px;
|
||||||
|
list-style-position: inside;
|
||||||
|
}
|
||||||
|
/* ---------------------------------------------------
|
||||||
|
RESPONSIVENESS
|
||||||
|
Nuke it from orbit. It's the only way to be sure.
|
||||||
|
------------------------------------------------------ */
|
||||||
|
/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
|
||||||
|
.container {
|
||||||
|
display: block!important;
|
||||||
|
max-width: 600px!important;
|
||||||
|
margin: 0 auto!important; /* makes it centered */
|
||||||
|
clear: both!important;
|
||||||
|
}
|
||||||
|
/* Set the padding on the td rather than the div for Outlook compatibility */
|
||||||
|
.body-wrap .container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
/* This should also be a block element, so that it will fill 100% of the .container */
|
||||||
|
.content {
|
||||||
|
max-width: 600px;
|
||||||
|
margin: 0 auto;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
/* Let's make sure tables in the content area are 100% wide */
|
||||||
|
.content table {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
|
||||||
{% block content %}{% endblock %}
|
<body bgcolor="#f6f6f6">
|
||||||
|
|
||||||
|
<!-- body -->
|
||||||
|
<table class="body-wrap" bgcolor="#f6f6f6">
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="container" bgcolor="#FFFFFF">
|
||||||
|
<div class="content">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{ content }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<!-- /body -->
|
||||||
|
|
||||||
|
<!-- footer -->
|
||||||
|
<table class="footer-wrap">
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class="container">
|
||||||
|
<div class="content">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td align="center">
|
||||||
|
{{ 'EMAIL_FOOTER'|t }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<!-- /footer -->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,25 +1,17 @@
|
|||||||
{% extends 'partials/base.html.twig' %}
|
{% embed 'partials/login.html.twig' with {title:'Grav Forgot Password'} %}
|
||||||
|
|
||||||
{% block page %}
|
{% block form %}
|
||||||
<section id="admin-login" class="default-glow-shadow">
|
{% for field in page.header.form.fields %}
|
||||||
<h1>
|
{% if field.type %}
|
||||||
Grav forgot password
|
<div>
|
||||||
</h1>
|
{% include ["forms/fields/#{field.type}/#{field.type}.html.twig", 'forms/fields/text/text.html.twig'] %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
<div class="form-actions secondary-accent">
|
||||||
|
<button type="submit" class="button primary" name="task" value="forgot"><i class="fa fa-paper-plane"></i> {{ "LOGIN_BTN_SEND_INSTRUCTIONS"|t }}</button>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% include 'partials/messages.html.twig' %}
|
{% endembed %}
|
||||||
|
|
||||||
<form method="post" action="{{ base_url_relative }}">
|
|
||||||
{% for field in page.header.form.fields %}
|
|
||||||
{% if field.type %}
|
|
||||||
<div>
|
|
||||||
{% include ["forms/fields/#{field.type}/#{field.type}.html.twig", 'forms/fields/text/text.html.twig'] %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
<div class="form-actions secondary-accent">
|
|
||||||
<button type="submit" class="button primary" name="task" value="forgot"><i class="fa fa-paper-plane"></i> Send reset instructions</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</section>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
name="{{ (scope ~ field.name)|fieldName }}"
|
name="{{ (scope ~ field.name)|fieldName }}"
|
||||||
value="{{ value|join(', ') }}"
|
value="{{ value|join(', ') }}"
|
||||||
{% if field.placeholder %}placeholder="{{ field.placeholder }}"{% endif %}
|
{% if field.placeholder %}placeholder="{{ field.placeholder }}"{% endif %}
|
||||||
|
{% if field.title %}title="{{ field.title }}"{% endif %}
|
||||||
{% if field.autofocus in ['on', 'true', 1] %}autofocus="autofocus"{% endif %}
|
{% if field.autofocus in ['on', 'true', 1] %}autofocus="autofocus"{% endif %}
|
||||||
{% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
|
{% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
|
||||||
{% if field.autocomplete in ['on', 'off'] %}autocomplete="{{ field.autocomplete }}"{% endif %}
|
{% if field.autocomplete in ['on', 'off'] %}autocomplete="{{ field.autocomplete }}"{% endif %}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
name="{{ (scope ~ field.name)|fieldName }}"
|
name="{{ (scope ~ field.name)|fieldName }}"
|
||||||
value="{{ value|join(', ') }}"
|
value="{{ value|join(', ') }}"
|
||||||
{% if field.placeholder %}placeholder="{{ field.placeholder }}"{% endif %}
|
{% if field.placeholder %}placeholder="{{ field.placeholder }}"{% endif %}
|
||||||
|
{% if field.title %}title="{{ field.title }}"{% endif %}
|
||||||
{% if field.autofocus in ['on', 'true', 1] %}autofocus="autofocus"{% endif %}
|
{% if field.autofocus in ['on', 'true', 1] %}autofocus="autofocus"{% endif %}
|
||||||
{% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
|
{% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
|
||||||
{% if field.readonly in ['on', 'true', 1] %}readonly="readonly"{% endif %}
|
{% if field.readonly in ['on', 'true', 1] %}readonly="readonly"{% endif %}
|
||||||
|
|||||||
@@ -1,15 +1,7 @@
|
|||||||
{% extends 'partials/base.html.twig' %}
|
{% embed 'partials/login.html.twig' with {title:'Grav Login'} %}
|
||||||
|
|
||||||
{% block page %}
|
{% block form %}
|
||||||
<section id="admin-login" class="default-glow-shadow">
|
{% for field in page.header.form.fields %}
|
||||||
<h1>
|
|
||||||
Grav Login
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
{% include 'partials/messages.html.twig' %}
|
|
||||||
|
|
||||||
<form method="post" action="{{ base_url_relative }}">
|
|
||||||
{% for field in page.header.form.fields %}
|
|
||||||
{% if field.type %}
|
{% if field.type %}
|
||||||
<div>
|
<div>
|
||||||
{% include ["forms/fields/#{field.type}/#{field.type}.html.twig", 'forms/fields/text/text.html.twig'] %}
|
{% include ["forms/fields/#{field.type}/#{field.type}.html.twig", 'forms/fields/text/text.html.twig'] %}
|
||||||
@@ -17,10 +9,10 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<div class="form-actions secondary-accent">
|
<div class="form-actions secondary-accent">
|
||||||
<a class="button secondary" href="{{ base_url_relative }}/forgot"><i class="fa fa-exclamation-circle"></i> Forgot</a>
|
<a class="button secondary" href="{{ base_url_relative }}/forgot"><i class="fa fa-exclamation-circle"></i> {{ 'LOGIN_BTN_FORGOT'|t }}</a>
|
||||||
<button type="submit" class="button primary" name="task" value="login"><i class="fa fa-sign-in"></i> Login</button>
|
<button type="submit" class="button primary" name="task" value="login"><i class="fa fa-sign-in"></i> {{ 'LOGIN_BTN'|t }}</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
{% endblock %}
|
||||||
</section>
|
|
||||||
{% endblock %}
|
{% endembed %}
|
||||||
|
|
||||||
|
|||||||
15
themes/grav/templates/partials/login.html.twig
Normal file
15
themes/grav/templates/partials/login.html.twig
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{% extends 'partials/base.html.twig' %}
|
||||||
|
|
||||||
|
{% block page %}
|
||||||
|
<section id="admin-login" class="default-glow-shadow">
|
||||||
|
<h1>
|
||||||
|
{{ title }}
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
{% include 'partials/messages.html.twig' %}
|
||||||
|
|
||||||
|
<form method="post" action="{{ base_url_relative }}">
|
||||||
|
{% block form %}{% endblock %}
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
||||||
@@ -1,29 +1,19 @@
|
|||||||
{% extends 'partials/base.html.twig' %}
|
{% embed 'partials/login.html.twig' with {title:'Grav Reset Password'} %}
|
||||||
|
|
||||||
{% block page %}
|
{% block form %}
|
||||||
<section id="admin-login" class="default-glow-shadow">
|
{% for field in page.header.form.fields %}
|
||||||
<h1>
|
{% set value = attribute(admin.forgot, field.name) is defined ? attribute(admin.forgot, field.name) : null %}
|
||||||
Reset Grav password
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
{% include 'partials/messages.html.twig' %}
|
{% if field.type %}
|
||||||
|
<div>
|
||||||
|
{% include ["forms/fields/#{field.type}/#{field.type}.html.twig", 'forms/fields/text/text.html.twig'] %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
<div class="form-actions secondary-accent">
|
||||||
|
<button type="submit" class="button primary" name="task" value="reset"><i class="fa fa-key"></i> {{ 'LOGIN_BTN_RESET'|t }}</button>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
<form method="post" action="{{ base_url_relative }}">
|
{% endembed %}
|
||||||
|
|
||||||
{% for field in page.header.form.fields %}
|
|
||||||
{% set value = attribute(admin.forgot, field.name) is defined ? attribute(admin.forgot, field.name) : null %}
|
|
||||||
|
|
||||||
{% if field.type %}
|
|
||||||
<div>
|
|
||||||
{% include ["forms/fields/#{field.type}/#{field.type}.html.twig", 'forms/fields/text/text.html.twig'] %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<div class="form-actions secondary-accent">
|
|
||||||
<button type="submit" class="button primary" name="task" value="reset"><i class="fa fa-key"></i> Reset password</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</section>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user