1
0
mirror of https://github.com/flarum/core.git synced 2025-05-11 18:05:29 +02:00
php-flarum/js/forum/src/components/change-password-modal.js
Toby Zerner 99876e9e36 Initial refactor of client actions, data preloading, SEO
An initial stab at flarum/core#126. Still WIP. Preliminary
implementation of flarum/core#128 and flarum/core#13.
2015-07-07 15:29:21 +09:30

31 lines
847 B
JavaScript

import FormModal from 'flarum/components/form-modal';
export default class ChangePasswordModal extends FormModal {
view() {
return super.view({
className: 'modal-sm change-password-modal',
title: 'Change Password',
body: m('div.form-centered', [
m('p.help-text', 'Click the button below and check your email for a link to change your password.'),
m('div.form-group', [
m('button.btn.btn-primary.btn-block[type=submit]', {disabled: this.loading()}, 'Send Password Reset Email')
])
])
});
}
onsubmit(e) {
e.preventDefault();
this.loading(true);
m.request({
method: 'POST',
url: app.forum.attribute('apiUrl')+'/forgot',
data: {email: app.session.user().email()},
background: true
}).then(response => {
this.hide();
});
}
}