home/autoph/public_html/projects/Rating-AutoHub/public/js/auth/login.js 0000644 00000004416 15025017654 0022233 0 ustar 00 (function(e){
"use strict";
$(function(){
$('#forget-password').on('click', function(e){
e.preventDefault();
var formData = new FormData;
formData.append("email", $('#forgot_email').val());
$.ajax({
type:"POST",
url:"/forgot_password",
dataType: 'json',
data: formData,
processData: false,
contentType: false,
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(e){
swal.fire({
icon: 'success',
title: "success",
text: e.message,
showConfirmButton: true,
allowOutsideClick: false
}).then((result) => {
if(result.isConfirmed){
window.location.href = '/';
}
});
// toastRWithTime(e.message,'success');
// setTimeout(function(){
// }, 10000);
},
error: function(error){
console.log(error);
toastRWithTime(error.responseJSON['message'],"error");
}
});
});
$('#login-btn').on('click', function(){
var formData = new FormData();
formData.append('email',$('#user_name_login').val());
formData.append('password',$('#user_name_password').val());
$.ajax({
type:"POST",
url:"/login",
dataType: 'json',
data: formData,
processData: false,
contentType: false,
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(e){
window.location.href = '/dashboard';
},
error: function(error){
toastRWithTime("Wrong username or password","error");
}
});
});
});
})();