Show success message to the user
This commit is contained in:
parent
435626f4b7
commit
19ef901768
3 changed files with 8 additions and 8 deletions
|
@ -33,10 +33,11 @@ class ForgotPasswordController extends Controller
|
||||||
/**
|
/**
|
||||||
* Get the response for a successful password reset link.
|
* Get the response for a successful password reset link.
|
||||||
*
|
*
|
||||||
* @param string $response
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param string $response
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
protected function sendResetLinkResponse($response): JsonResponse
|
protected function sendResetLinkResponse(Request $request, $response): JsonResponse
|
||||||
{
|
{
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status' => trans($response),
|
'status' => trans($response),
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import http from '@/api/http';
|
import http from '@/api/http';
|
||||||
|
|
||||||
export default (email: string): Promise<void> => {
|
export default (email: string): Promise<string> => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
http.post('/auth/password', { email })
|
http.post('/auth/password', { email })
|
||||||
.then(() => resolve())
|
.then(response => resolve(response.data.status || ''))
|
||||||
.catch(reject);
|
.catch(reject);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,13 +33,12 @@ class ForgotPasswordContainer extends React.PureComponent<Props, State> {
|
||||||
this.setState({ isSubmitting: true }, () => {
|
this.setState({ isSubmitting: true }, () => {
|
||||||
this.props.clearAllFlashMessages();
|
this.props.clearAllFlashMessages();
|
||||||
requestPasswordResetEmail(this.state.email)
|
requestPasswordResetEmail(this.state.email)
|
||||||
.then(() => {
|
.then(response => this.props.pushFlashMessage({
|
||||||
// @todo actually handle this.
|
type: 'success', title: 'Success', message: response,
|
||||||
})
|
}))
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
this.props.pushFlashMessage({
|
this.props.pushFlashMessage({
|
||||||
id: 'auth:forgot-password',
|
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: 'Error',
|
title: 'Error',
|
||||||
message: httpErrorToHuman(error),
|
message: httpErrorToHuman(error),
|
||||||
|
|
Loading…
Reference in a new issue