/*========================================================================================= File Name: auth-forgot-password.js Description: Auth forgot password js file. ---------------------------------------------------------------------------------------- Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template Author: PIXINVENT Author URL: http://www.themeforest.net/user/pixinvent ==========================================================================================*/ $(function () { 'use strict'; var pageForgotPasswordForm = $('.auth-forgot-password-form'); // jQuery Validation // -------------------------------------------------------------------- if (pageForgotPasswordForm.length) { pageForgotPasswordForm.validate({ /* * ? To enable validation onkeyup onkeyup: function (element) { $(element).valid(); },*/ /* * ? To enable validation on focusout onfocusout: function (element) { $(element).valid(); }, */ rules: { 'fp_email': { required: true, email: true } }, submitHandler: function (form) { $.ajax({ type: "POST", url: "/api/auth_forgotpassword", dataType: "json", data: $(form).serialize(), beforeSend: function() { Swal.fire({ title: 'Please wait...', html: 'We are validating your account.', allowEscapeKey: false, allowOutsideClick: false, didOpen: () => { Swal.showLoading() } }); }, success: function (response) { console.log(response); if (response.status == 1) { Swal.fire( 'Good job!', 'Password reset link is sent to your email.', 'success' ).then(function (result) { if (true) { window.location.href = response.data['redirect_to']; } }) console.log(response); }else{ Swal.fire({ title: 'Error ' + response.responseCode + '!', text: response.message, icon: 'error', customClass: { confirmButton: 'btn btn-primary' }, buttonsStyling: false }); } } }); return false; // required to block normal submit since you used ajax } }); } });