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>
<% } %>
</div>
</form>
</div>

View file

@ -1,5 +1,6 @@
<div class='content-wrapper' id='password-reset'>
<h1>Password reset</h1>
<% if (ctx.canSendMails) { %>
<form autocomplete='off'>
<ul class='input'>
<li>
@ -20,4 +21,10 @@
<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);

View file

@ -25,12 +25,18 @@ thumbnails:
post_width: 300
post_height: 300
# used to send password reminders
# used to send password reset e-mails
smtp:
host: # example: localhost
port: # example: 25
user: # example: bot
pass: # example: groovy123
# host can be left empty, in which case it is recommended to fill contactEmail.
contactEmail: # example: bob@example.com. Meant for manual password reset procedures
# used for reverse image search
elasticsearch:
@ -38,15 +44,16 @@ elasticsearch:
port: 9200
index: szurubooru
limits:
users_per_page: 20
posts_per_page: 40
max_comment_length: 5000
tag_name_regex: ^\S+$
tag_category_name_regex: ^[^\s%+#/]+$
default_rank: regular
# don't change these, unless you want to annoy people. if you do customize
# them though, make sure to update the instructions in the registration form
@ -54,6 +61,9 @@ default_rank: regular
password_regex: '^.{5,}$'
user_name_regex: '^[a-zA-Z0-9_-]{1,32}$'
default_rank: regular
privileges:
'users:create': anonymous
'users:list': regular