diff --git a/app/Http/Controllers/Api/V1/Auth/ForgotPasswordController.php b/app/Http/Controllers/Api/V1/Auth/ForgotPasswordController.php
index 4b85bc6..50cf9f1 100755
--- a/app/Http/Controllers/Api/V1/Auth/ForgotPasswordController.php
+++ b/app/Http/Controllers/Api/V1/Auth/ForgotPasswordController.php
@@ -32,7 +32,7 @@ public function sendResetLinkEmail(Request $request) : JsonResponse
$request->input('routeSuffix'),
':',
true
- ).$token;
+ ).$token.'?email='.$user->email;
$resetLink = route('backoffice.welcome').'#'.$routeSuffix;
diff --git a/resources/js/views/auth/passwords/Request.js b/resources/js/views/auth/passwords/Request.js
index f06b432..56d2111 100755
--- a/resources/js/views/auth/passwords/Request.js
+++ b/resources/js/views/auth/passwords/Request.js
@@ -4,9 +4,9 @@ import { Formik, Form, withFormik } from 'formik';
import * as Yup from 'yup';
import { Grid, TextField, Button, Link, withStyles } from '@material-ui/core';
-import { Auth as AuthLayout } from '../../layouts';
import * as NavigationUtils from '../../../utils/Navigation';
import * as UrlUtils from '../../../utils/URL';
+import { Auth as AuthLayout } from '../../layouts';
class PasswordRequest extends Component {
state = {
@@ -37,22 +37,20 @@ class PasswordRequest extends Component {
routeSuffix,
});
- if (response.status === 200) {
- this.setState({
- loading: false,
- message: {
- type: 'success',
- title: 'Link Sent',
- body: (
-
- Check your email to reset your account.
-
Thank you.
-
- ),
- action: () => history.push(`/signin?username=${email}`),
- },
- });
- }
+ this.setState({
+ loading: false,
+ message: {
+ type: 'success',
+ title: 'Link Sent',
+ body: (
+
+ Check your email to reset your account.
+
Thank you.
+
+ ),
+ action: () => history.push(`/signin?username=${email}`),
+ },
+ });
} catch (error) {
if (!error.response) {
this.setState({
@@ -95,8 +93,7 @@ class PasswordRequest extends Component {
}
render() {
- const { classes, location, setErrors, errors: formErrors } = this.props;
-
+ const { classes, location } = this.props;
const { loading, message, email } = this.state;
return (
@@ -114,88 +111,78 @@ class PasswordRequest extends Component {
: email,
}}
onSubmit={this.handleRequestPasswordSubmit}
- validate={values => {
- setErrors({});
- }}
validationSchema={Yup.object().shape({
email: Yup.string().required(
- `The email field is required`,
+ Lang.get('validation.required', {
+ attribute: 'email',
+ }),
),
})}
>
- {({ values, handleChange, errors, isSubmitting }) => {
- if (formErrors && Object.keys(formErrors).length > 0) {
- errors = formErrors;
- }
-
- return (
-
+ )}
);
diff --git a/resources/js/views/auth/passwords/Reset.js b/resources/js/views/auth/passwords/Reset.js
index 540b566..48fff29 100755
--- a/resources/js/views/auth/passwords/Reset.js
+++ b/resources/js/views/auth/passwords/Reset.js
@@ -1,7 +1,268 @@
import React, { Component } from 'react';
+import { Link as RouterLink } from 'react-router-dom';
+import { Formik, Form, withFormik } from 'formik';
+import * as Yup from 'yup';
+
+import {
+ Button,
+ Grid,
+ IconButton,
+ InputAdornment,
+ Link,
+ TextField,
+ withStyles,
+} from '@material-ui/core';
+
+import {
+ Visibility as VisibilityIcon,
+ VisibilityOff as VisibilityOffIcon,
+} from '@material-ui/icons';
+
+import * as NavigationUtils from '../../../utils/Navigation';
+import * as UrlUtils from '../../../utils/URL';
+import { Auth as AuthLayout } from '../../layouts';
+
+class PasswordReset extends Component {
+ state = {
+ loading: false,
+ message: {},
+ showPassword: false,
+ showPasswordConfirmation: false,
+ };
+
+ /**
+ * Handle password visibility toggle.
+ *
+ * @param {string} name The name of the password field flag.
+ *
+ * @return {undefined}
+ */
+ handlePasswordVisibilityToggle = name => {
+ this.setState(prevState => {
+ return {
+ [name]: !prevState[name],
+ };
+ });
+ };
+
+ /**
+ * Handle Password Reset submission.
+ *
+ * @param {object} event
+ *
+ * @return {undefined}
+ */
+ handleSubmit = async (values, { setSubmitting }) => {
+ setSubmitting(false);
+ };
-export default class PasswordReset extends Component {
render() {
- return Password Reset
;
+ const { classes, location } = this.props;
+ const email = UrlUtils._queryParams(location.search).hasOwnProperty(
+ 'email',
+ )
+ ? UrlUtils._queryParams(location.search).email
+ : '';
+
+ const {
+ loading,
+ message,
+ showPassword,
+ showPasswordConfirmation,
+ } = this.state;
+
+ return (
+
+
+ {({ values, handleChange, errors, isSubmitting }) => (
+
+ )}
+
+
+ );
}
}
+
+const styles = theme => ({
+ formGroup: {
+ padding: theme.spacing.unit * 2,
+ paddingTop: 0,
+ },
+});
+
+export default withStyles(styles)(withFormik({})(PasswordReset));
diff --git a/resources/lang/en/navigation.php b/resources/lang/en/navigation.php
index 1e639e6..094ae70 100644
--- a/resources/lang/en/navigation.php
+++ b/resources/lang/en/navigation.php
@@ -20,8 +20,11 @@
'previous' => 'Previous',
'password_request_title' => 'Account Recovery',
'password_request_subtitle' => "Enter your email and we'll send a recovery link",
+ 'password_reset_title' => 'Reset Password',
+ 'password_reset_subtitle' => "You can now set your new password",
'signin' => 'Sign in instead',
'send_link' => 'Send Link',
+ 'reset' => 'Reset',
'notifications' => 'Notifications',
diff --git a/resources/lang/fil/navigation.php b/resources/lang/fil/navigation.php
index 8e96ef8..ef663de 100644
--- a/resources/lang/fil/navigation.php
+++ b/resources/lang/fil/navigation.php
@@ -20,8 +20,11 @@
'previous' => 'Nakaraan',
'password_request_title' => 'Pag-recover sa Account',
'password_request_subtitle' => 'Ipasok ang iyong email at magpapadala kami ng recovery link',
+ 'password_reset_title' => 'Reset Password',
+ 'password_reset_subtitle' => "Maaari mo nang i-set ang iyong bagong password",
'signin' => 'Mag-sign in nalang',
'send_link' => 'I-send ang Link',
+ 'reset' => 'I-reset',
'notifications' => 'Mga Abiso',
diff --git a/tests/Feature/Api/V1/Auth/ForgotPasswordTest.php b/tests/Feature/Api/V1/Auth/ForgotPasswordTest.php
new file mode 100644
index 0000000..9d71dba
--- /dev/null
+++ b/tests/Feature/Api/V1/Auth/ForgotPasswordTest.php
@@ -0,0 +1,11 @@
+