diff --git a/app/gabsocial/actions/auth.js b/app/gabsocial/actions/auth.js
index 5556085d9..32088edf7 100644
--- a/app/gabsocial/actions/auth.js
+++ b/app/gabsocial/actions/auth.js
@@ -162,7 +162,8 @@ export function resetPassword(nickNameOrEmail) {
return api(getState).post('/auth/password', params).then(() => {
dispatch({ type: RESET_PASSWORD_SUCCESS });
}).catch(error => {
- dispatch({ type: RESET_PASSWORD_FAIL });
+ dispatch({ type: RESET_PASSWORD_FAIL, error });
+ throw error;
});
};
}
diff --git a/app/gabsocial/features/auth_login/components/login_form.js b/app/gabsocial/features/auth_login/components/login_form.js
index 99eb2a9b9..b33254fe1 100644
--- a/app/gabsocial/features/auth_login/components/login_form.js
+++ b/app/gabsocial/features/auth_login/components/login_form.js
@@ -1,5 +1,6 @@
import React from 'react';
import { connect } from 'react-redux';
+import { Link } from 'react-router-dom';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { logIn } from 'gabsocial/actions/auth';
import { fetchMe } from 'gabsocial/actions/me';
@@ -40,9 +41,9 @@ class LoginForm extends ImmutablePureComponent {
diff --git a/app/gabsocial/features/auth_login/components/password_reset.js b/app/gabsocial/features/auth_login/components/password_reset.js
new file mode 100644
index 000000000..11e5ec443
--- /dev/null
+++ b/app/gabsocial/features/auth_login/components/password_reset.js
@@ -0,0 +1,50 @@
+import React from 'react';
+import { connect } from 'react-redux';
+import ImmutablePureComponent from 'react-immutable-pure-component';
+import { resetPassword } from 'gabsocial/actions/auth';
+import { SimpleForm, FieldsGroup, TextInput } from 'gabsocial/features/forms';
+import { Redirect } from 'react-router-dom';
+import { showAlert } from 'gabsocial/actions/alerts';
+
+export default @connect()
+class PasswordReset extends ImmutablePureComponent {
+
+ state = {
+ isLoading: false,
+ success: false,
+ }
+
+ handleSubmit = e => {
+ const { dispatch } = this.props;
+ const nicknameOrEmail = e.target.nickname_or_email.value;
+ this.setState({ isLoading: true });
+ dispatch(resetPassword(nicknameOrEmail)).then(() => {
+ this.setState({ isLoading: false, success: true });
+ dispatch(showAlert('Password reset received. Check your email for further instructions.', ''));
+ }).catch(error => {
+ this.setState({ isLoading: false });
+ });
+ }
+
+ render() {
+ if (this.state.success) return
;
+
+ return (
+
+
+
+
+
+
+ );
+ }
+
+}
diff --git a/app/gabsocial/features/ui/index.js b/app/gabsocial/features/ui/index.js
index b9c9efb06..98c53204f 100644
--- a/app/gabsocial/features/ui/index.js
+++ b/app/gabsocial/features/ui/index.js
@@ -71,6 +71,7 @@ import {
LoginPage,
Preferences,
EditProfile,
+ PasswordReset,
} from './util/async-components';
// Dummy import, to make sure that
ends up in the application bundle.
@@ -191,9 +192,8 @@ class SwitchingColumnsArea extends React.PureComponent {
return (
- {/* */}
- {/* */}
+
diff --git a/app/gabsocial/features/ui/util/async-components.js b/app/gabsocial/features/ui/util/async-components.js
index b9c846cdd..823a91eb2 100644
--- a/app/gabsocial/features/ui/util/async-components.js
+++ b/app/gabsocial/features/ui/util/async-components.js
@@ -173,3 +173,7 @@ export function Preferences() {
export function EditProfile() {
return import(/* webpackChunkName: "features/edit_profile" */'../../edit_profile');
}
+
+export function PasswordReset() {
+ return import(/* webpackChunkName: "features/auth_login" */'../../auth_login/components/password_reset');
+}