diff --git a/app/Http/Controllers/V1/Auth/IsRegisteredController.php b/app/Http/Controllers/V1/Auth/IsRegisteredController.php deleted file mode 100644 index 69682e7c..00000000 --- a/app/Http/Controllers/V1/Auth/IsRegisteredController.php +++ /dev/null @@ -1,25 +0,0 @@ -email)->first()) { - return 'true'; - } else { - return 'false'; - } - } -} diff --git a/resources/assets/js/bootstrap.js b/resources/assets/js/bootstrap.js index 1f84ebda..afcb0b8b 100644 --- a/resources/assets/js/bootstrap.js +++ b/resources/assets/js/bootstrap.js @@ -97,7 +97,7 @@ global.axios.interceptors.response.use(undefined, function (err) { } if (!err.response) { window.toastr['error']( - 'Network error: Please check your internet connection or wait until servers are back online' + 'Please check your internet connection or wait until servers are back online', 'Network Error' ) } else { if ( @@ -121,7 +121,7 @@ global.axios.interceptors.response.use(undefined, function (err) { window.toastr['error']( err.response.data.message ? err.response.data.message - : 'Unknown error occurred' + : err.response.data || 'Unknown error occurred', 'Error' ) } } diff --git a/resources/assets/js/store/modules/auth/actions.js b/resources/assets/js/store/modules/auth/actions.js index be471ff9..1851377f 100644 --- a/resources/assets/js/store/modules/auth/actions.js +++ b/resources/assets/js/store/modules/auth/actions.js @@ -48,16 +48,3 @@ export const logout = ({ state, commit }) => { }) }) } - -export const checkMail = ({ commit }, data) => { - return new Promise((resolve, reject) => { - window.axios - .post('/api/v1/is-registered', data) - .then((response) => { - resolve(response) - }) - .catch((err) => { - reject(err) - }) - }) -} diff --git a/resources/assets/js/views/auth/ForgotPassword.vue b/resources/assets/js/views/auth/ForgotPassword.vue index 7341a86f..b0f86551 100644 --- a/resources/assets/js/views/auth/ForgotPassword.vue +++ b/resources/assets/js/views/auth/ForgotPassword.vue @@ -20,19 +20,24 @@ - {{ $t('validation.send_reset_link') }} - - - {{ $t('validation.not_yet') }} +
+ {{ $t('validation.send_reset_link') }} +
+
+ {{ $t('validation.not_yet') }} +
- + {{ $t('general.back_to_login') }}
@@ -52,7 +57,6 @@ export default { }, isSent: false, isLoading: false, - isRegisteredUser: false, } }, validations: { @@ -64,14 +68,9 @@ export default { }, }, methods: { - ...mapActions('auth', ['checkMail']), + ...mapActions('auth'), async validateBeforeSubmit(e) { this.$v.formData.$touch() - let { data } = await this.checkMail() - if (data === false) { - toastr['error'](this.$t('validation.email_does_not_exist')) - return - } if (!this.$v.formData.$invalid) { try { this.isLoading = true @@ -87,19 +86,10 @@ export default { this.isSent = true this.isLoading = false } catch (err) { - if (err.response && err.response.status === 403) { - toastr['error'](err.response.data, 'Error') - } + this.isLoading = false } } }, - // async checkMail() { - // let response = await window.axios.post( - // '/api/v1/is-registered', - // this.formData - // ) - // return response.data - // }, }, } diff --git a/routes/api.php b/routes/api.php index f8848235..ca34f6a5 100644 --- a/routes/api.php +++ b/routes/api.php @@ -96,12 +96,6 @@ Route::prefix('/v1')->group(function () { Route::get('/app/version', AppVersionController::class); - // Email is registered - // ---------------------------------- - - Route::get('/is/registered', IsRegisteredController::class); - - // Authentication & Password Reset //---------------------------------- @@ -112,7 +106,7 @@ Route::prefix('/v1')->group(function () { Route::post('logout', [AuthController::class, 'logout'])->middleware('auth:sanctum'); // Send reset password mail - Route::post('password/email', [ForgotPasswordController::class, 'sendResetLinkEmail']); + Route::post('password/email', [ForgotPasswordController::class, 'sendResetLinkEmail'])->middleware("throttle:10,2");; // handle reset password form process Route::post('reset/password', [ResetPasswordController::class, 'reset']);