1
0
mirror of https://github.com/flarum/core.git synced 2025-07-24 18:21:33 +02:00

Remove ability for users to delete themselves

This commit is contained in:
Toby Zerner
2015-08-04 21:35:41 +09:30
parent 5fa7a8c555
commit 187517a9c7
5 changed files with 1 additions and 88 deletions

View File

@@ -1,70 +0,0 @@
import Modal from 'flarum/components/Modal';
import Button from 'flarum/components/Button';
/**
* 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 (
<div className="Modal-body">
<div className="Form Form--centered">
<div className="helpText">
<p>{app.trans('core.delete_account_help')}</p>
<ul>
<li>{app.trans('core.username_will_be_released')}</li>
<li>{app.trans('core.posts_will_remain')}</li>
</ul>
</div>
<div className="Form-group">
<input className="FormControl"
name="confirm"
placeholder="Type 'DELETE' to proceed"
oninput={m.withAttr('value', this.confirmation)}/>
</div>
<div className="Form-group">
{Button.component({
className: 'Button Button--primary Button--block',
type: 'submit',
loading: this.loading,
disabled: this.confirmation() !== 'DELETE',
children: app.trans('core.delete_account')
})}
</div>
</div>
</div>
);
}
onsubmit(e) {
e.preventDefault();
if (this.confirmation() !== 'DELETE') return;
this.loading = true;
app.session.user.delete().then(() => app.session.logout());
}
}

View File

@@ -6,7 +6,6 @@ import FieldSet from 'flarum/components/FieldSet';
import NotificationGrid from 'flarum/components/NotificationGrid';
import ChangePasswordModal from 'flarum/components/ChangePasswordModal';
import ChangeEmailModal from 'flarum/components/ChangeEmailModal';
import DeleteAccountModal from 'flarum/components/DeleteAccountModal';
import listItems from 'flarum/helpers/listItems';
/**
@@ -88,14 +87,6 @@ export default class SettingsPage extends UserPage {
})
);
items.add('deleteAccount',
Button.component({
children: app.trans('core.delete_account'),
className: 'Button Button--danger',
onclick: () => app.modal.show(new DeleteAccountModal())
})
);
return items;
}