server/password-reset: support having no smtp

This commit is contained in:
rr-
2017-02-17 23:08:37 +01:00
parent 32d15a493c
commit c01214e919
5 changed files with 45 additions and 24 deletions

View File

@ -0,0 +1,2 @@
#password-reset
max-width: 30em

View File

@ -30,9 +30,7 @@
<div class='buttons'>
<input type='submit' value='Log in'/>
<% if (ctx.canSendMails) { %>
<a class='append' href='<%- ctx.formatClientLink('password-reset') %>'>Forgot the password?</a>
<% } %>
<a class='append' href='<%- ctx.formatClientLink('password-reset') %>'>Forgot the password?</a>
</div>
</form>
</div>

View File

@ -1,23 +1,30 @@
<div class='content-wrapper' id='password-reset'>
<h1>Password reset</h1>
<form autocomplete='off'>
<ul class='input'>
<li>
<%= ctx.makeTextInput({
text: 'User name or e-mail address',
name: 'user-name',
required: true,
}) %>
</li>
</ul>
<% if (ctx.canSendMails) { %>
<form autocomplete='off'>
<ul class='input'>
<li>
<%= ctx.makeTextInput({
text: 'User name or e-mail address',
name: 'user-name',
required: true,
}) %>
</li>
</ul>
<p><small>Proceeding will send an e-mail that contains a password reset
link. Clicking it is going to generate a new password for your account.
It is recommended to change that password to something else.</small></p>
<p><small>Proceeding will send an e-mail that contains a password reset
link. Clicking it is going to generate a new password for your account.
It is recommended to change that password to something else.</small></p>
<div class='messages'></div>
<div class='buttons'>
<input type='submit' value='Proceed'/>
</div>
</form>
<div class='messages'></div>
<div class='buttons'>
<input type='submit' value='Proceed'/>
</div>
</form>
<% } else { %>
<p>We do not support automatic password resetting.</p>
<% if (ctx.contactEmail) { %>
<p>Please send an e-mail to <a href='mailto:<%- ctx.contactEmail %>'><%- ctx.contactEmail %></a> to go through a manual procedure.</p>
<% } %>
<% } %>
</div>

View File

@ -1,5 +1,6 @@
'use strict';
const config = require('../config.js');
const events = require('../events.js');
const views = require('../util/views.js');
@ -10,7 +11,10 @@ class PasswordResetView extends events.EventTarget {
super();
this._hostNode = document.getElementById('content-holder');
views.replaceContent(this._hostNode, template());
views.replaceContent(this._hostNode, template({
canSendMails: config.canSendMails,
contactEmail: config.contactEmail,
}));
views.syncScrollPosition();
views.decorateValidator(this._formNode);