import Modal from 'flarum/components/Modal'; /** * The `DeleteAccountModal` component shows a modal dialog which allows the user * to delete their account. * * @todo require typing password instead of DELETE */ export default class DeleteAccountModal extends Modal { constructor(props) { super(props); /** * The value of the confirmation input. * * @type {Function} */ this.confirmation = m.prop(); } className() { return 'DeleteAccountModal Modal--small'; } title() { return app.trans('core.delete_account'); } content() { return (

{app.trans('core.delete_account_help')}

  • {app.trans('core.username_will_be_released')}
  • {app.trans('core.posts_will_remain')}
); } onsubmit(e) { e.preventDefault(); if (this.confirmation() !== 'DELETE') return; this.loading = true; app.session.user.delete().then(() => app.session.logout()); } }