diff options
| author | rr- | 2017-02-17 23:08:37 +0100 |
|---|---|---|
| committer | rr- | 2017-02-17 23:10:51 +0100 |
| commit | c01214e919d0872d7b7644b2ec9d7472d8c6bbc9 (patch) | |
| tree | 47a4f7fe2443e9e242f087f940b3c2071f9c2cc6 /client | |
| parent | 32d15a493c713dcfbe56bafb4e8ce92a5ee40df1 (diff) | |
server/password-reset: support having no smtp
Diffstat (limited to 'client')
| -rw-r--r-- | client/css/password-reset.styl | 2 | ||||
| -rw-r--r-- | client/html/login.tpl | 4 | ||||
| -rw-r--r-- | client/html/password_reset.tpl | 43 | ||||
| -rw-r--r-- | client/js/views/password_reset_view.js | 6 |
4 files changed, 33 insertions, 22 deletions
diff --git a/client/css/password-reset.styl b/client/css/password-reset.styl new file mode 100644 index 0000000..47e32f3 --- /dev/null +++ b/client/css/password-reset.styl @@ -0,0 +1,2 @@ +#password-reset + max-width: 30em diff --git a/client/html/login.tpl b/client/html/login.tpl index 8ccc439..186a548 100644 --- a/client/html/login.tpl +++ b/client/html/login.tpl @@ -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> diff --git a/client/html/password_reset.tpl b/client/html/password_reset.tpl index b50b48e..5671379 100644 --- a/client/html/password_reset.tpl +++ b/client/html/password_reset.tpl @@ -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> diff --git a/client/js/views/password_reset_view.js b/client/js/views/password_reset_view.js index 38ac719..25409c7 100644 --- a/client/js/views/password_reset_view.js +++ b/client/js/views/password_reset_view.js @@ -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); |