/* jshint ignore:start */ import React from 'react'; import Button from 'misago/components/button'; import ajax from 'misago/services/ajax'; import title from 'misago/services/page-title'; import snackbar from 'misago/services/snackbar'; import store from 'misago/services/store'; import misago from 'misago'; export default class extends React.Component { constructor(props) { super(props); this.state = { isLoading: false, password: '', }; } componentDidMount() { title.set({ title: gettext("Delete account"), parent: gettext("Change your options") }); } onPasswordChange = (event) => { this.setState({ password: event.target.value }); } handleSubmit = (event) => { event.preventDefault(); const { isLoading, password } = this.state; const { user } = this.props; if (password.length == 0) { snackbar.error(gettext("Enter your password to confirm account deletion.")); return false; } if (isLoading) return false; this.setState({ isLoading: true }); ajax.post(user.api.delete, { password }).then( (success) => { window.location.href = misago.get('MISAGO_PATH'); }, (rejection) => { this.setState({ isLoading: false }); if (rejection.password) { snackbar.error(rejection.password[0]); } else { snackbar.apiError(rejection) } } ); } render() { return (

{gettext("Delete account")}

{gettext("You are going to delete your account. This action is nonreversible, and will result in following data being deleted:")}

- {gettext("Stored IP addresses associated with content that you have posted will be deleted.")}

- {gettext("Your username will become available for other user to rename to or for new user to register their account with.")}

- {gettext("Your e-mail will become available for use in new account registration.")}


{gettext("All your posted content will NOT be deleted, but username associated with it will be changed to one shared by all deleted accounts.")}

); } }