diff --git a/plugins/talk-plugin-local-auth/client/components/ChangePassword.js b/plugins/talk-plugin-local-auth/client/components/ChangePassword.js
index e5535b8ba..8f86fff48 100644
--- a/plugins/talk-plugin-local-auth/client/components/ChangePassword.js
+++ b/plugins/talk-plugin-local-auth/client/components/ChangePassword.js
@@ -105,7 +105,13 @@ class ChangePassword extends React.Component {
this.setState(initialState);
};
- onSave = async () => {
+ onSave = async e => {
+ e.preventDefault();
+
+ if (this.isSubmitBlocked()) {
+ return;
+ }
+
const { oldPassword, newPassword } = this.state.formData;
try {
@@ -125,6 +131,23 @@ class ChangePassword extends React.Component {
this.disableEditing();
};
+ onForgotPassword = async () => {
+ const { root: { me: { email } } } = this.props;
+
+ try {
+ await this.props.forgotPassword(email);
+ this.props.notify(
+ 'success',
+ t('talk-plugin-local-auth.change_password.forgot_password_sent')
+ );
+ } catch (err) {
+ this.props.notify('error', getErrorMessages(err));
+ }
+
+ this.clearForm();
+ this.disableEditing();
+ };
+
disableEditing = () => {
this.setState({
editing: false,
@@ -152,8 +175,11 @@ class ChangePassword extends React.Component {
{t('talk-plugin-local-auth.change_password.change_password')}
- {editing && (
-
- )}
- {editing ? (
-
) : (