szurubooru/client/js/views/password_reset_view.js

57 lines
1.3 KiB
JavaScript
Raw Normal View History

'use strict';
const events = require('../events.js');
const views = require('../util/views.js');
const template = views.getTemplate('password-reset');
class PasswordResetView extends events.EventTarget {
constructor() {
super();
this._hostNode = document.getElementById('content-holder');
views.replaceContent(this._hostNode, template());
2016-07-13 17:18:28 +02:00
views.syncScrollPosition();
2016-07-13 17:18:28 +02:00
views.decorateValidator(this._formNode);
this._hostNode.addEventListener('submit', e => {
e.preventDefault();
this.dispatchEvent(new CustomEvent('submit', {
detail: {
userNameOrEmail: this._userNameOrEmailFieldNode.value,
},
}));
});
}
showSuccess(message) {
views.showSuccess(this._hostNode, message);
}
2016-04-08 10:35:38 +02:00
showError(message) {
views.showError(this._hostNode, message);
}
clearMessages() {
views.clearMessages(this._hostNode);
}
enableForm() {
views.enableForm(this._formNode);
}
disableForm() {
views.disableForm(this._formNode);
}
get _formNode() {
return this._hostNode.querySelector('form');
}
2016-04-08 10:35:38 +02:00
get _userNameOrEmailFieldNode() {
return this._formNode.querySelector('#user-name');
}
}
module.exports = PasswordResetView;