add changes
Этот коммит содержится в:
поставляемый
+383
@@ -0,0 +1,383 @@
|
||||
function initLogin() {
|
||||
let reg_name, reg_email, reg_number, reg_pwd, reg_otp_email;
|
||||
let loginForm = $("#login_form");
|
||||
let registerForm = $("#register_form");
|
||||
|
||||
// document.querySelector('#register_form .otp-input-group input.press').addEventListener("paste", function (p) {
|
||||
// var data = p.clipboardData.getData('text');
|
||||
// var dataLength = data.length;
|
||||
|
||||
// for (var i = 0; i < dataLength; i++) {
|
||||
// var input = document.querySelector("#register_form .otp-input-group input[tabindex='" + (i + 1) + "']");
|
||||
// input.value = data.charAt(i);
|
||||
// if (input.value.length >= input.maxLength) {
|
||||
// var nextInput = document.querySelector("#register_form .otp-input-group input[tabindex='" + (i + 2) + "']");
|
||||
// if (nextInput) {
|
||||
// nextInput.focus();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// p.preventDefault();
|
||||
// });
|
||||
// document.querySelectorAll('#register_form .otp-input-group input[type="text"]').forEach(function (input) {
|
||||
// input.addEventListener('keyup', function (e) {
|
||||
// if (this.value.length >= this.maxLength) {
|
||||
// if (e.keyCode !== 9 && e.keyCode !== 16) {
|
||||
// var tabIndex = this.tabIndex + 1;
|
||||
// document.querySelector("#register_form .otp-input-group input[tabindex='" + this.tabIndex + "']").value = this.value;
|
||||
// document.querySelector("#register_form .otp-input-group input[tabindex='" + tabIndex + "']").focus();
|
||||
// }
|
||||
// } else {
|
||||
// if (e.keyCode === 8) {
|
||||
// var tabIndex = this.tabIndex - 1;
|
||||
// document.querySelector("#register_form .otp-input-group input[tabindex='" + tabIndex + "']").focus();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
$('#register_form .otp-input-group input.press').on('paste', function (p) {
|
||||
var data = p.originalEvent.clipboardData.getData('text');
|
||||
var dataLength = data.length;
|
||||
|
||||
for (var i = 0; i < dataLength; i++) {
|
||||
var input = $('#register_form .otp-input-group input[tabindex="' + (i + 1) + '"]');
|
||||
input.val(data.charAt(i));
|
||||
if (input.val().length >= input.attr('maxlength')) {
|
||||
var nextInput = $('#register_form .otp-input-group input[tabindex="' + (i + 2) + '"]');
|
||||
if (nextInput) {
|
||||
nextInput.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
p.preventDefault();
|
||||
});
|
||||
|
||||
$('#register_form .otp-input-group input[type="text"]').on('keyup', function (e) {
|
||||
if ($(this).val().length >= $(this).attr('maxlength')) {
|
||||
if (e.keyCode !== 9 && e.keyCode !== 16) {
|
||||
var tabIndex = parseInt($(this).attr('tabindex')) + 1;
|
||||
$('#register_form .otp-input-group input[tabindex="' + $(this).attr('tabindex') + '"]').val($(this).val());
|
||||
$('#register_form .otp-input-group input[tabindex="' + tabIndex + '"]').focus();
|
||||
}
|
||||
} else {
|
||||
if (e.keyCode === 8) {
|
||||
var tabIndex = parseInt($(this).attr('tabindex')) - 1;
|
||||
$('#register_form .otp-input-group input[tabindex="' + tabIndex + '"]').focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
loginForm.find("#User_Email,#User_password").keypress(function (e) {
|
||||
if (e.which == 13)
|
||||
document.getElementById("Login_btn").click();
|
||||
|
||||
});
|
||||
|
||||
$("#Login_btn").click(function () {
|
||||
loginForm.find(".loader-btn").show();
|
||||
$(this).hide();
|
||||
let userEmail = loginForm.find("#User_Email").val();
|
||||
let userPassword = loginForm.find("#User_password").val();
|
||||
let emailInput = loginForm.find(".email-login-inputgroup");
|
||||
let passwordInput = loginForm.find(".password-login-inputgroup");
|
||||
if (userEmail == "") {
|
||||
emailInput.find('#User_Email').addClass('is-invalid');
|
||||
emailInput.find('.form-floating').addClass('is-invalid');
|
||||
emailInput.find('.invalid-feedback').text('Please enter your email');
|
||||
loginForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
|
||||
}
|
||||
if (userPassword == "") {
|
||||
passwordInput.find('#User_password').addClass('is-invalid');
|
||||
passwordInput.find('.form-floating').addClass('is-invalid');
|
||||
loginForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
}
|
||||
else {
|
||||
emailInput.find('#User_Email').removeClass('is-invalid');
|
||||
emailInput.find('.form-floating').removeClass('is-invalid');
|
||||
passwordInput.find('#User_password').removeClass('is-invalid');
|
||||
passwordInput.find('.form-floating').removeClass('is-invalid');
|
||||
if (validateEmail(userEmail)) {
|
||||
let port = SERVERNAME
|
||||
// let port = "http://localhost:3088";
|
||||
let url = `${port}/account/getuserbyphoneormail/${userEmail}/${userEmail}`;
|
||||
getDataStatAxios(url, userEmail);
|
||||
} else {
|
||||
loginForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
emailInput.find('#User_Email').addClass('is-invalid');
|
||||
emailInput.find('.form-floating').addClass('is-invalid');
|
||||
emailInput.find('.invalid-feedback').text('Please enter a valid email');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
async function getDataStatAxios(url, userEmail) {
|
||||
const config = {
|
||||
url,
|
||||
method: "get",
|
||||
};
|
||||
let response = await axios(config);
|
||||
if (response.data.result == null) {
|
||||
$('.error-div').text(response.data.message);
|
||||
}
|
||||
else {
|
||||
let userEmail = $("#User_Email").val();
|
||||
let userPassword = $("#User_password").val();
|
||||
const loginPayload = {
|
||||
username: userEmail,
|
||||
Password: userPassword,
|
||||
UnibaseId: "",
|
||||
RememberMe: false,
|
||||
};
|
||||
const res = await postAPIService(
|
||||
`bizgaze/crm/webapi/crmuserlogin`,
|
||||
loginPayload
|
||||
);
|
||||
debugger;
|
||||
console.log(res);
|
||||
if (res.data.message == "200") {
|
||||
// Command: toastr["success"]("Logged in successfully")
|
||||
// toasterOpts();
|
||||
debugger;
|
||||
COOKIE_HELPER_ACTIONS.setCookie({
|
||||
token: res.data.result.sessionId,
|
||||
userid: res.data.result.userId,
|
||||
...res.data.result
|
||||
})
|
||||
// setInitLoginLocal();
|
||||
// window.localStorage.setItem("Useremail", userEmail);
|
||||
//window.localStorage.setItem("Userpassword", userPassword);
|
||||
//window.localStorage.setItem("Isloggedin", true);
|
||||
const isCartAdded = localStorage.getItem(CART_ADD);
|
||||
if(isCartAdded){
|
||||
localStorage.removeItem(CART_ADD);
|
||||
window.location.href = `/selectdelivery.html`;
|
||||
return;
|
||||
}
|
||||
window.location.href = `/index.html`;
|
||||
} else {
|
||||
$("#empt_num").removeClass("d-none text-success").text(res.data.message).addClass('text-danger');
|
||||
$(".my_avatar").attr("href", "./login.html");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// this function will be triggered on new user registration
|
||||
async function userRegistration() {
|
||||
reg_form = $('#register_form');
|
||||
// reg_name = $("#User_Name").val();
|
||||
reg_email = reg_form.find("#User_Email").val();
|
||||
// reg_otp_email = $("#User_otp_Email").val();
|
||||
// reg_number = $("#user_number").val();
|
||||
reg_pwd = reg_form.find("#User_password").val();
|
||||
let userName = reg_email.split("@");
|
||||
let otpRes = null;
|
||||
const userRegistratioNPayload = {
|
||||
organizationtypeid: "2",
|
||||
organizationid: "0",
|
||||
contactid: "0",
|
||||
userid: "0",
|
||||
username: "0",
|
||||
users_phonenumber: "0",
|
||||
password: reg_pwd,
|
||||
users_emailaddress: "0",
|
||||
emailaddress: reg_email,
|
||||
contactname: userName[0],
|
||||
phonenumber: "0",
|
||||
branchid: "0",
|
||||
tenantname: "Anwi Systems",
|
||||
rolename: "Customer Admin",
|
||||
currencyid: "0",
|
||||
customerformuniqueid: "Bizgaze_Platform_Crm_RegisterCRMUser",
|
||||
};
|
||||
$('.spinner-border').removeClass('d-none');
|
||||
const res = await postAPIService(
|
||||
`bizgaze/crm/webapi/registercrmuser`,
|
||||
userRegistratioNPayload
|
||||
);
|
||||
console.log(res, "register");
|
||||
$('.spinner-border').addClass('d-none');
|
||||
if (res.data.message == "User Already Exists!") {
|
||||
$('.error-div').text('User Already Exists!');
|
||||
// $(".useralready_exist").removeClass("d-none");
|
||||
} else {
|
||||
}
|
||||
|
||||
$("#proceed").click(async function () {
|
||||
let userEnterOtp = "";
|
||||
let userEmail = registerForm.find("#User_Email").val();
|
||||
$('.otp-input-group input').each(function () {
|
||||
let presVal = $(this).val();
|
||||
userEnterOtp += presVal;
|
||||
})
|
||||
console.log(userEnterOtp);
|
||||
debugger;
|
||||
const userotppayload = {
|
||||
email: userEmail,
|
||||
otpid: res.data.result.OtpId,
|
||||
userotp: userEnterOtp,
|
||||
};
|
||||
$('.spinner-border').removeClass('d-none');
|
||||
otpRes = await postAPIService(
|
||||
`bizgaze/crm/webapi/ValidateOtp`,
|
||||
userotppayload
|
||||
);
|
||||
$('.spinner-border').addClass('d-none');
|
||||
debugger;
|
||||
console.log(otpRes, "otp");
|
||||
const verifyotpStatus = otpRes.data.result;
|
||||
debugger;
|
||||
if (verifyotpStatus == "Otp verified successfully") {
|
||||
alert("Account created successfully");
|
||||
window.location.href = `/myaccount.html`;
|
||||
} else {
|
||||
alert("please enter valid otp");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// to validate password on keyup in password input field
|
||||
function passwordValidate(pswd) {
|
||||
if (pswd.length < 11) {
|
||||
$('#chck_length').removeClass('pswd_valid').addClass('pswd_invalid');
|
||||
} else {
|
||||
$('#chck_length').removeClass('pswd_invalid').addClass('pswd_valid');
|
||||
}
|
||||
// validate uppercase letter
|
||||
if (pswd.match(/[A-Z]/)) {
|
||||
$('#chck_capital').removeClass('pswd_invalid').addClass('pswd_valid');
|
||||
} else {
|
||||
$('#chck_capital').removeClass('pswd_valid').addClass('pswd_invalid');
|
||||
}
|
||||
//validate special letter
|
||||
if (pswd.match(/[!@#$%^&*]/)) {
|
||||
$('#chck_special').removeClass('pswd_invalid').addClass('pswd_valid');
|
||||
} else {
|
||||
$('#chck_special').removeClass('pswd_valid').addClass('pswd_invalid');
|
||||
}
|
||||
let pswdVal = $('#register_form #User_password').val();
|
||||
let pattern = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{11,}$/;
|
||||
if (pswdVal.match(pattern)) {
|
||||
$('#pswd_info').hide()
|
||||
}
|
||||
else {
|
||||
$('#pswd_info').show()
|
||||
}
|
||||
//validate number
|
||||
if (pswd.match(/\d/)) {
|
||||
$('#chck_number').removeClass('pswd_invalid').addClass('pswd_valid');
|
||||
} else {
|
||||
$('#chck_number').removeClass('pswd_valid').addClass('pswd_invalid');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//you have to use keyup, because keydown will not catch the currently entered value
|
||||
$('#register_form #User_password').keyup(function () {
|
||||
// set password variable
|
||||
var pswd = $(this).val();
|
||||
passwordValidate(pswd);
|
||||
}).focus(function () {
|
||||
let pswdVal = $('#register_form #User_password').val();
|
||||
let pattern = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{11,}$/;
|
||||
if (pswdVal.match(pattern)) {
|
||||
$('#pswd_info').hide()
|
||||
}
|
||||
else {
|
||||
$('#pswd_info').show()
|
||||
}
|
||||
}).blur(function () {
|
||||
$('#pswd_info').hide();
|
||||
});
|
||||
|
||||
// function to validate user entered email
|
||||
function validateEmail(userEmail) {
|
||||
var pattern =
|
||||
/^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
|
||||
return $.trim(userEmail).match(pattern) ? true : false;
|
||||
}
|
||||
|
||||
// function to validate user entered password
|
||||
function validatepassword(userPassword) {
|
||||
var pattern = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{11,}$/;
|
||||
return $.trim(userPassword).match(pattern) ? true : false;
|
||||
}
|
||||
|
||||
registerForm.find("#User_Email,#User_password").keypress(function (e) {
|
||||
if (e.which == 13)
|
||||
document.getElementById("register_btn").click();
|
||||
|
||||
});
|
||||
|
||||
// this will be triggered on clicking continue in signup form
|
||||
$("#register_btn").click(function () {
|
||||
registerForm.find(".loader-btn").show();
|
||||
$(this).hide();
|
||||
let userEmail = registerForm.find("#User_Email").val();
|
||||
let userPassword = registerForm.find("#User_password").val();
|
||||
let emailInput = registerForm.find(".email-login-inputgroup");
|
||||
let passwordInput = registerForm.find(".password-login-inputgroup");
|
||||
if (userEmail == "") {
|
||||
emailInput.find('#User_Email').addClass('is-invalid');
|
||||
emailInput.find('.form-floating').addClass('is-invalid');
|
||||
emailInput.find('.invalid-feedback').text('Please enter your email');
|
||||
registerForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
}
|
||||
if (userPassword == "") {
|
||||
passwordInput.find('#User_password').addClass('is-invalid');
|
||||
passwordInput.find('.form-floating').addClass('is-invalid');
|
||||
registerForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
}
|
||||
else {
|
||||
emailInput.find('#User_Email').removeClass('is-invalid');
|
||||
emailInput.find('.form-floating').removeClass('is-invalid');
|
||||
passwordInput.find('#User_password').removeClass('is-invalid');
|
||||
passwordInput.find('.form-floating').removeClass('is-invalid');
|
||||
if (validateEmail(userEmail)) {
|
||||
$('#register_form .email-password-group').hide();
|
||||
$('#register_form .otp-input-group').show();
|
||||
$('#register_form .otp-input-group .otp-sent-email').text(userEmail);
|
||||
userRegistration();
|
||||
} else {
|
||||
emailInput.find('#User_Email').addClass('is-invalid');
|
||||
emailInput.find('.form-floating').addClass('is-invalid');
|
||||
emailInput.find('.invalid-feedback').text('Please enter a valid email');
|
||||
registerForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#forgotPassword').click(function () {
|
||||
$('.login-email-password-div').hide();
|
||||
$('.login-forgot-passsword-div').show();
|
||||
})
|
||||
|
||||
function toasterOpts() {
|
||||
toastr.options = {
|
||||
"closeButton": true,
|
||||
"debug": false,
|
||||
"newestOnTop": true,
|
||||
"progressBar": true,
|
||||
"positionClass": "toast-top-center",
|
||||
"preventDuplicates": true,
|
||||
"showDuration": "300",
|
||||
"hideDuration": "1000",
|
||||
"timeOut": "3000",
|
||||
"extendedTimeOut": "1000",
|
||||
"showEasing": "swing",
|
||||
"hideEasing": "linear",
|
||||
"showMethod": "fadeIn",
|
||||
"hideMethod": "fadeOut"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initLogin();
|
||||
поставляемый
+780
@@ -0,0 +1,780 @@
|
||||
function initLogin() {
|
||||
// alert('as')
|
||||
// Command: toastr["success"]("Logged in successfully")
|
||||
// Command: toastr["success"]("My name is Inigo Montoya. You killed my father. Prepare to die!")
|
||||
|
||||
// toasterOpts();
|
||||
let reg_name, reg_email, reg_number, reg_pwd, reg_otp_email;
|
||||
let loginForm = $("#login_form");
|
||||
let registerForm = $("#register_form");
|
||||
|
||||
$("#register_form .otp-input-group input.press").on("paste", function (p) {
|
||||
var data = p.originalEvent.clipboardData.getData("text");
|
||||
var dataLength = data.length;
|
||||
|
||||
for (var i = 0; i < dataLength; i++) {
|
||||
var input = $(
|
||||
'#register_form .otp-input-group input[tabindex="' + (i + 1) + '"]'
|
||||
);
|
||||
input.val(data.charAt(i));
|
||||
if (input.val().length >= input.attr("maxlength")) {
|
||||
var nextInput = $(
|
||||
'#register_form .otp-input-group input[tabindex="' + (i + 2) + '"]'
|
||||
);
|
||||
if (nextInput) {
|
||||
nextInput.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
p.preventDefault();
|
||||
});
|
||||
|
||||
$('#register_form .otp-input-group input[type="text"]').on(
|
||||
"keyup",
|
||||
function (e) {
|
||||
if ($(this).val().length >= $(this).attr("maxlength")) {
|
||||
if (e.keyCode !== 9 && e.keyCode !== 16) {
|
||||
var tabIndex = parseInt($(this).attr("tabindex")) + 1;
|
||||
$(
|
||||
'#register_form .otp-input-group input[tabindex="' +
|
||||
$(this).attr("tabindex") +
|
||||
'"]'
|
||||
).val($(this).val());
|
||||
$(
|
||||
'#register_form .otp-input-group input[tabindex="' + tabIndex + '"]'
|
||||
).focus();
|
||||
}
|
||||
} else {
|
||||
if (e.keyCode === 8) {
|
||||
var tabIndex = parseInt($(this).attr("tabindex")) - 1;
|
||||
$(
|
||||
'#register_form .otp-input-group input[tabindex="' + tabIndex + '"]'
|
||||
).focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
loginForm.find("#User_Email,#User_password").keypress(function (e) {
|
||||
if (e.which == 13) $("#Login_btn").click();
|
||||
});
|
||||
|
||||
$("#Login_btn").click(function () {
|
||||
$('.error_msg').hide();
|
||||
// loginForm.find(".loader-btn").show();
|
||||
let userEmail = loginForm.find("#User_Email").val();
|
||||
let userPassword = loginForm.find("#User_password").val();
|
||||
let emailInput = loginForm.find(".email-login-inputgroup");
|
||||
let passwordInput = loginForm.find(".password-login-inputgroup");
|
||||
if (userEmail == "") {
|
||||
emailInput.find("#User_Email").addClass("is-invalid");
|
||||
emailInput.find(".form-floating").addClass("is-invalid");
|
||||
emailInput.find(".invalid-feedback").text("Please enter your email");
|
||||
loginForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
}
|
||||
if (userPassword == "") {
|
||||
passwordInput.find("#User_password").addClass("is-invalid");
|
||||
passwordInput.find(".form-floating").addClass("is-invalid");
|
||||
loginForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
} else {
|
||||
emailInput.find("#User_Email").removeClass("is-invalid");
|
||||
emailInput.find(".form-floating").removeClass("is-invalid");
|
||||
passwordInput.find("#User_password").removeClass("is-invalid");
|
||||
passwordInput.find(".form-floating").removeClass("is-invalid");
|
||||
if (validateEmail(userEmail)) {
|
||||
let port = SERVERNAME
|
||||
// let port = "http://localhost:3088";
|
||||
let url = `${port}/account/getuserbyphoneormail/${userEmail}/${userEmail}`;
|
||||
getDataStatAxios(url, userEmail);
|
||||
} else {
|
||||
loginForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
emailInput.find("#User_Email").addClass("is-invalid");
|
||||
emailInput.find(".form-floating").addClass("is-invalid");
|
||||
emailInput.find(".invalid-feedback").text("Please enter a valid email");
|
||||
}
|
||||
}
|
||||
});
|
||||
async function getDataStatAxios(url, userEmail) {
|
||||
const config = {
|
||||
url,
|
||||
method: "get",
|
||||
};
|
||||
let response = await axios(config);
|
||||
if (response.data.result == null) {
|
||||
$('.error_msg').show();
|
||||
$('.error_msg .error_msg_res').html(`User doesn't exists with the email, <a href="#" class="alert-link register_sectionbtn" id="register_sectionbtn">Sign Up </a>`);
|
||||
$(".register_sectionbtn").click(function(){
|
||||
|
||||
|
||||
$(".login_section").css("display","none");
|
||||
$(".register_section").css("display","block");
|
||||
$(".login_section").find("#User_Email").removeClass("is-invalid");
|
||||
$(".login_section").find(".form-floating").removeClass("is-invalid");
|
||||
$(".login_section").find("#User_password").removeClass("is-invalid");
|
||||
$(".login_section").find(".form-floating").removeClass("is-invalid");
|
||||
$('.error_msg').hide();
|
||||
});
|
||||
// toasterOpts();
|
||||
|
||||
// Command: toastr["error"]("Please enter Valid email / password");
|
||||
} else {
|
||||
let userEmail = $("#User_Email").val();
|
||||
let userPassword = $("#User_password").val();
|
||||
const loginPayload = {
|
||||
username: userEmail,
|
||||
Password: userPassword,
|
||||
UnibaseId: "",
|
||||
RememberMe: false,
|
||||
};
|
||||
$("#Login_btn").hide();
|
||||
$(".loader-btn").show();
|
||||
const res = await postAPIService(
|
||||
`bizgaze/crm/webapi/crmuserlogin`,
|
||||
loginPayload
|
||||
);
|
||||
debugger;
|
||||
console.log(res);
|
||||
$(".loader-btn").hide();
|
||||
$("#Login_btn").show();
|
||||
if (res.data.message == "200") {
|
||||
debugger;
|
||||
// Command: toastr["success"]("Logged in successfully")
|
||||
// toasterOpts();
|
||||
COOKIE_HELPER_ACTIONS.setCookie({
|
||||
token: res.data.result.sessionId,
|
||||
userid: res.data.result.userId,
|
||||
...res.data.result
|
||||
});
|
||||
// setInitLoginLocal();
|
||||
window.localStorage.setItem("Useremail", userEmail);
|
||||
//window.localStorage.setItem("Userpassword", userPassword);
|
||||
window.localStorage.setItem("Isloggedintoaster", true);
|
||||
window.localStorage.setItem("Isloggedin", true);
|
||||
|
||||
const isCartAdded = localStorage.getItem(CART_ADD);
|
||||
if(isCartAdded){
|
||||
localStorage.removeItem(CART_ADD);
|
||||
window.location.href = `/selectdelivery.html`;
|
||||
return;
|
||||
}
|
||||
|
||||
window.location.href = `./index.html`;
|
||||
} else {
|
||||
$('.error_msg').show();
|
||||
$('.error_msg .error_msg_res').html(res.data.message + ' <a class="validate_mail text-danger"><b>Validate Email</b></a>');
|
||||
// toasterOpts();
|
||||
// Command: toastr["error"]()
|
||||
/*Email validation*/
|
||||
$('.validate_mail').click(function(){
|
||||
$(".login_section").hide();
|
||||
$(".email-validate-div").show();
|
||||
$('.error_msg').hide();
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// this function will be triggered on new user registration
|
||||
async function userRegistration() {
|
||||
reg_form = $("#register_form");
|
||||
// reg_name = $("#User_Name").val();
|
||||
reg_email = reg_form.find("#User_Email").val();
|
||||
// reg_otp_email = $("#User_otp_Email").val();
|
||||
// reg_number = $("#user_number").val();
|
||||
reg_pwd = reg_form.find("#User_password").val();
|
||||
let userName = reg_email.split("@");
|
||||
let otpRes = null;
|
||||
const userRegistratioNPayload = {
|
||||
organizationtypeid: "2",
|
||||
organizationid: "0",
|
||||
contactid: "0",
|
||||
userid: "0",
|
||||
username: "0",
|
||||
users_phonenumber: "0",
|
||||
password: reg_pwd,
|
||||
users_emailaddress: "0",
|
||||
emailaddress: reg_email,
|
||||
contactname: userName[0],
|
||||
phonenumber: "0",
|
||||
branchid: "0",
|
||||
tenantname: "Anwi Systems",
|
||||
rolename: "Customer Admin",
|
||||
currencyid: "0",
|
||||
customerformuniqueid: "Bizgaze_Platform_Crm_RegisterCRMUser",
|
||||
};
|
||||
debugger;
|
||||
$('#register_btn').hide()
|
||||
$(".loader-btn").show();
|
||||
debugger;
|
||||
const res = await postAPIService(
|
||||
`bizgaze/crm/webapi/registercrmuser`,
|
||||
userRegistratioNPayload
|
||||
);
|
||||
console.log(res, "register");
|
||||
$(".loader-btn").hide();
|
||||
$('#register_btn').show()
|
||||
if (res.data.code == "404" ) {
|
||||
// toasterOpts();
|
||||
// Command: toastr["error"](res.data.message)
|
||||
$('.error_msg').show();
|
||||
$('.error_msg .error_msg_res').html(res.data.message);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$("#register_form .email-password-group").hide();
|
||||
$("#register_form .register_otp.otp-input-group").show();
|
||||
}
|
||||
|
||||
$("#proceed").click(async function () {
|
||||
let userEnterOtp = "";
|
||||
let userEmail = registerForm.find("#User_Email").val();
|
||||
$(".otp-input-group input").each(function () {
|
||||
let presVal = $(this).val();
|
||||
userEnterOtp += presVal;
|
||||
});
|
||||
console.log(userEnterOtp);
|
||||
debugger;
|
||||
const userotppayload = {
|
||||
email: userEmail,
|
||||
otpid: res.data.result.OtpId,
|
||||
userotp: userEnterOtp,
|
||||
};
|
||||
$(".loader-btn").show();
|
||||
$('#proceed').hide()
|
||||
otpRes = await postAPIService(
|
||||
`bizgaze/crm/webapi/ValidateOtp`,
|
||||
userotppayload
|
||||
);
|
||||
$(".loader-btn").hide();
|
||||
$('#proceed').show()
|
||||
debugger;
|
||||
console.log(otpRes, "otp");
|
||||
const verifyotpStatus = otpRes.data.result;
|
||||
if (verifyotpStatus == "Otp verified successfully") {
|
||||
const loginPayload = {
|
||||
username: reg_email,
|
||||
Password: reg_pwd,
|
||||
UnibaseId: "",
|
||||
RememberMe: false,
|
||||
};
|
||||
const res = await postAPIService(
|
||||
`bizgaze/crm/webapi/crmuserlogin`,
|
||||
loginPayload
|
||||
);
|
||||
if (res.data.message == "200") {
|
||||
debugger;
|
||||
// Command: toastr["success"]("Logged in successfully")
|
||||
// toasterOpts();
|
||||
COOKIE_HELPER_ACTIONS.setCookie({
|
||||
token: res.data.result.sessionId,
|
||||
userid: res.data.result.userId,
|
||||
...res.data.result
|
||||
});
|
||||
// setInitLoginLocal();
|
||||
window.localStorage.setItem("Useremail", userEmail);
|
||||
//window.localStorage.setItem("Userpassword", userPassword);
|
||||
window.localStorage.setItem("isaccountCreated", true);
|
||||
const isCartAdded = localStorage.getItem(CART_ADD);
|
||||
if(isCartAdded){
|
||||
localStorage.removeItem(CART_ADD);
|
||||
window.location.href = `/selectdelivery.html`;
|
||||
return;
|
||||
}
|
||||
window.location.href = `./index.html`;
|
||||
} else {
|
||||
// toasterOpts();
|
||||
// Command: toastr["error"](res.data.message)
|
||||
$('.error_msg').show();
|
||||
$('.error_msg .error_msg_res').html(res.data.message);
|
||||
}
|
||||
} else {
|
||||
// toasterOpts();
|
||||
// Command: toastr["error"]("Please enter Valid OTP");
|
||||
$('.error_msg').show();
|
||||
$('.error_msg .error_msg_res').html("Please enter Valid OTP");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// to validate password on keyup in password input field
|
||||
function passwordValidate(pswd) {
|
||||
if (pswd.length < 8) {
|
||||
$("#chck_length").removeClass("pswd_valid").addClass("pswd_invalid");
|
||||
} else {
|
||||
$("#chck_length").removeClass("pswd_invalid").addClass("pswd_valid");
|
||||
}
|
||||
// validate uppercase letter
|
||||
if (pswd.match(/[A-Z]/)) {
|
||||
$("#chck_capital").removeClass("pswd_invalid").addClass("pswd_valid");
|
||||
} else {
|
||||
$("#chck_capital").removeClass("pswd_valid").addClass("pswd_invalid");
|
||||
}
|
||||
//validate special letter
|
||||
if (pswd.match(/[!@#$%^&*]/)) {
|
||||
$("#chck_special").removeClass("pswd_invalid").addClass("pswd_valid");
|
||||
} else {
|
||||
$("#chck_special").removeClass("pswd_valid").addClass("pswd_invalid");
|
||||
}
|
||||
let pswdVal = $("#register_form #User_password").val();
|
||||
let pattern = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{8,}$/;
|
||||
if (pswdVal.match(pattern)) {
|
||||
$(".pswd_info").hide();
|
||||
} else {
|
||||
$(".pswd_info").show();
|
||||
}
|
||||
//validate number
|
||||
if (pswd.match(/\d/)) {
|
||||
$("#chck_number").removeClass("pswd_invalid").addClass("pswd_valid");
|
||||
} else {
|
||||
$("#chck_number").removeClass("pswd_valid").addClass("pswd_invalid");
|
||||
}
|
||||
}
|
||||
|
||||
//you have to use keyup, because keydown will not catch the currently entered value
|
||||
$("#register_form #User_password")
|
||||
.keyup(function () {
|
||||
// set password variable
|
||||
var pswd = $(this).val();
|
||||
passwordValidate(pswd);
|
||||
})
|
||||
.focus(function () {
|
||||
let pswdVal = $("#register_form #User_password").val();
|
||||
let pattern = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{11,}$/;
|
||||
if (pswdVal.match(pattern)) {
|
||||
$(".pswd_info").hide();
|
||||
} else {
|
||||
$(".pswd_info").show();
|
||||
}
|
||||
})
|
||||
.blur(function () {
|
||||
$(".pswd_info").hide();
|
||||
});
|
||||
|
||||
// function to validate user entered email
|
||||
function validateEmail(userEmail) {
|
||||
var pattern = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
|
||||
// return $.trim(userEmail).test(pattern) ? true : false;
|
||||
return pattern.test(userEmail) ? true : false;
|
||||
}
|
||||
|
||||
// function to validate user entered password
|
||||
function validatepassword(userPassword) {
|
||||
var pattern = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,15}$/;
|
||||
// return $.trim(userPassword).test(pattern) ? true : false;
|
||||
return pattern.test(userPassword) ? true : false;
|
||||
}
|
||||
|
||||
registerForm.find("#User_Email,#User_password").keypress(function (e) {
|
||||
if (e.which == 13) $("#register_btn").click();
|
||||
});
|
||||
|
||||
// this will be triggered on clicking continue in signup form
|
||||
$("#register_btn").click(function () {
|
||||
$('.error_msg').hide();
|
||||
registerForm.find(".loader-btn").show();
|
||||
$(this).hide();
|
||||
let userEmail = registerForm.find("#User_Email").val();
|
||||
let userPassword = registerForm.find("#User_password").val();
|
||||
let emailInput = registerForm.find(".email-login-inputgroup");
|
||||
let passwordInput = registerForm.find(".password-login-inputgroup");
|
||||
if (userEmail == "") {
|
||||
emailInput.find("#User_Email").addClass("is-invalid");
|
||||
emailInput.find(".form-floating").addClass("is-invalid");
|
||||
emailInput.find(".invalid-feedback").text("Please enter your email");
|
||||
registerForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
}
|
||||
if (userPassword == "") {
|
||||
passwordInput.find("#User_password").addClass("is-invalid");
|
||||
passwordInput.find(".form-floating").addClass("is-invalid");
|
||||
registerForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
} else {
|
||||
emailInput.find("#User_Email").removeClass("is-invalid");
|
||||
emailInput.find(".form-floating").removeClass("is-invalid");
|
||||
passwordInput.find("#User_password").removeClass("is-invalid");
|
||||
passwordInput.find(".form-floating").removeClass("is-invalid");
|
||||
let Email_valid = validateEmail(userEmail);
|
||||
let Pwd_valid = validatepassword(userPassword);
|
||||
if (Email_valid === true && Pwd_valid === true) {
|
||||
userRegistration();
|
||||
$("#register_form .otp-input-group .otp-sent-email").text(userEmail);
|
||||
} else if(Email_valid === false) {
|
||||
emailInput.find("#User_Email").addClass("is-invalid");
|
||||
emailInput.find(".form-floating").addClass("is-invalid");
|
||||
emailInput.find(".invalid-feedback").text("Please enter a valid email");
|
||||
registerForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
}else if(Pwd_valid === false){
|
||||
passwordInput.find("#User_password").addClass("is-invalid");
|
||||
passwordInput.find(".form-floating").addClass("is-invalid");
|
||||
passwordInput.find(".invalid-feedback").text("Please check the password!");
|
||||
registerForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
$(".pswd_eye").click(function(){
|
||||
let eyeClass = $(this).find('svg').hasClass("fa-eye-slash");
|
||||
if(eyeClass == true){
|
||||
$(this).find('svg').removeClass("fa-eye-slash");
|
||||
$(this).find('svg').addClass("fa-eye");
|
||||
$(this).siblings('input').attr('type','password')
|
||||
}else{
|
||||
$(this).find('svg').removeClass("fa-eye");
|
||||
$(this).find('svg').addClass("fa-eye-slash");
|
||||
$(this).siblings('input').attr('type','text')
|
||||
}
|
||||
})
|
||||
|
||||
$("#forgotPassword").click(function () {
|
||||
$(".login-email-password-div").hide();
|
||||
$(".login-forgot-password-div").show();
|
||||
});
|
||||
$("#forgot_Password_Back").click(function () {
|
||||
$(".login-forgot-password-div").hide();
|
||||
$(".login-email-password-div").show();
|
||||
});
|
||||
$("#forgot_password_submit").click(async function () {
|
||||
let forgot_email = $("#forgot_User_Email").val();
|
||||
if(forgot_email == ''){
|
||||
$('#forgot_User_Email').addClass('is-invalid')
|
||||
$('#forgot_User_Email').after(`<div class="invalid-feedback">Please enter Valid email</div>`);
|
||||
return
|
||||
}
|
||||
else{
|
||||
debugger;
|
||||
let port = SERVERNAME
|
||||
// let port = "http://localhost:3088";
|
||||
let url = `${port}/account/getuserbyphoneormail/${forgot_email}/${forgot_email}`;
|
||||
const config = {
|
||||
url,
|
||||
method: "get",
|
||||
};
|
||||
$(".loader-btn").show();
|
||||
$('#forgot_password_submit').hide()
|
||||
let response = await axios(config);
|
||||
debugger;
|
||||
console.log(response);
|
||||
$(".loader-btn").hide();
|
||||
$('#forgot_password_submit').show()
|
||||
if (response.data.result != null) {
|
||||
debugger;
|
||||
console.log(response.data);
|
||||
const forgotpassPayload = {
|
||||
firstname: "",
|
||||
lastname: "",
|
||||
contactnumber: "",
|
||||
email: "",
|
||||
tenantname: "",
|
||||
contactoremail: response.data.result.email,
|
||||
IsSignup: false,
|
||||
IsRegisterUser: false,
|
||||
IsForgotPswd: true,
|
||||
UnibaseId: response.data.result.userName,
|
||||
OtpId: 0,
|
||||
UserOtp: "",
|
||||
};
|
||||
$('#forgot_password_submit').hide()
|
||||
$(".loader-btn").show();
|
||||
const forgetpassRes = await postAPIService(
|
||||
`account/sendotp`,
|
||||
forgotpassPayload
|
||||
);
|
||||
$(".loader-btn").hide();
|
||||
console.log(forgetpassRes);
|
||||
$(".email-validation").hide();
|
||||
$('.user_email').html(forgot_email)
|
||||
$(".otp-validation .otp-input-group").show();
|
||||
$(".otp-validation .otp-input-group").on("paste", function (p) {
|
||||
let data = p.originalEvent.clipboardData.getData("text");
|
||||
let dataLength = data.length;
|
||||
for (let i = 0; i < dataLength; i++) {
|
||||
let input = $(
|
||||
'.otp-validation .otp-input-group input[tabindex="' + (i + 1) + '"]'
|
||||
);
|
||||
input.val(data.charAt(i));
|
||||
if (input.val().length >= input.attr("maxlength")) {
|
||||
let nextInput = $(
|
||||
'.otp-validation .otp-input-group input[tabindex="' +
|
||||
(i + 2) +
|
||||
'"]'
|
||||
);
|
||||
if (nextInput) {
|
||||
nextInput.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
p.preventDefault();
|
||||
});
|
||||
|
||||
$('.otp-validation .otp-input-group input[type="text"]').on(
|
||||
"keyup",
|
||||
function (e) {
|
||||
if ($(this).val().length >= $(this).attr("maxlength")) {
|
||||
if (e.keyCode !== 9 && e.keyCode !== 16) {
|
||||
let tabIndex = parseInt($(this).attr("tabindex")) + 1;
|
||||
$(
|
||||
'.otp-validation .otp-input-group input[tabindex="' +
|
||||
$(this).attr("tabindex") +
|
||||
'"]'
|
||||
).val($(this).val());
|
||||
$(
|
||||
'.otp-validation .otp-input-group input[tabindex="' +
|
||||
tabIndex +
|
||||
'"]'
|
||||
).focus();
|
||||
}
|
||||
} else {
|
||||
if (e.keyCode === 8) {
|
||||
let tabIndex = parseInt($(this).attr("tabindex")) - 1;
|
||||
$(
|
||||
'.otp-validation .otp-input-group input[tabindex="' +
|
||||
tabIndex +
|
||||
'"]'
|
||||
).focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
$("#Forgot_pass_proceed").click(async function () {
|
||||
debugger;
|
||||
let userotp='';
|
||||
$(".otp-validation .otp-input-group input").each(function () {
|
||||
let presVal = $(this).val();
|
||||
userotp += presVal;
|
||||
});
|
||||
console.log(userotp);
|
||||
const validateForgotpass = {
|
||||
email: forgot_email,
|
||||
otpid: forgetpassRes.data,
|
||||
userotp: userotp,
|
||||
};
|
||||
$('#Forgot_pass_proceed').hide()
|
||||
$(".loader-btn").show();
|
||||
const forgetpassResotp = await postAPIService(
|
||||
`hyperfusion/validateotp`,
|
||||
validateForgotpass
|
||||
);
|
||||
$(".loader-btn").hide();
|
||||
$('#Forgot_pass_proceed').show()
|
||||
console.log(forgetpassResotp);
|
||||
const Resotp = forgetpassResotp.data.result;
|
||||
if (Resotp == "Otp verified successfully") {
|
||||
$(".login-forgot-password-details-div").show();
|
||||
$(".otp-validation .otp-input-group").hide();
|
||||
} else {
|
||||
// toasterOpts()
|
||||
// Command: toastr["error"]("Please enter Valid OTP");
|
||||
$('.error_msg').show();
|
||||
$('.error_msg .error_msg_res').html("Please enter Valid OTP");
|
||||
}
|
||||
});
|
||||
$("#forgot_password_details_submit").click(async function () {
|
||||
debugger;
|
||||
let pswdone =$("#forgot-password-input-one").val();
|
||||
let pswdtwo =$("#forgot-password-input-two").val();
|
||||
if(pswdone == pswdtwo) {
|
||||
const forgotpassPayload = {
|
||||
username: response.data.result.userName,
|
||||
password: pswdtwo,
|
||||
};
|
||||
$("#forgot_password_details_submit").hide();
|
||||
$(".loader-btn").show();
|
||||
const forgetpassRes = await postAPIService(
|
||||
`account/UpdatePassword`,
|
||||
forgotpassPayload
|
||||
);
|
||||
console.log(forgetpassRes);
|
||||
$(".loader-btn").hide();
|
||||
$("#forgot_password_details_submit").show();
|
||||
window.localStorage.setItem('Ispasswordupdate',true)
|
||||
window.location.href = `./myaccount.html`;
|
||||
}else {
|
||||
$("#forgot-password-input-one").addClass('is-invalid');
|
||||
$("#forgot-password-input-two").addClass('is-invalid')
|
||||
$('.password_display').text('Passwords are not matched !').addClass('text-danger')
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
else{
|
||||
$('#forgot_User_Email').addClass('is-invalid');
|
||||
$('#forgot_User_Email').after(`<div class="invalid-feedback">Please enter Valid email</div>`);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
$(".user_pass")
|
||||
.keyup(function () {
|
||||
// set password variable
|
||||
var pswd = $(this).val();
|
||||
passwordValidate(pswd);
|
||||
$('.pswd_info').hide();
|
||||
$(this).parent().siblings('.pswd_info').show();
|
||||
})
|
||||
.focus(function () {
|
||||
let pswdVal = $(this).val();
|
||||
let pattern = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{8,}$/;
|
||||
if (pswdVal.match(pattern)) {
|
||||
$(this).parent().siblings('.pswd_info').hide();
|
||||
} else {
|
||||
$(this).parent().siblings('.pswd_info').show();
|
||||
}
|
||||
})
|
||||
.blur(function () {
|
||||
$(this).parent().siblings('.pswd_info').hide();
|
||||
});
|
||||
|
||||
function toasterOpts(){
|
||||
toastr.options = {
|
||||
"closeButton": true,
|
||||
"debug": false,
|
||||
"newestOnTop": true,
|
||||
"progressBar": true,
|
||||
"positionClass": "toast-top-center",
|
||||
"preventDuplicates": true,
|
||||
"onclick": null,
|
||||
"showDuration": "300",
|
||||
"hideDuration": "1000",
|
||||
"timeOut": "5000",
|
||||
"extendedTimeOut": "1000",
|
||||
"showEasing": "swing",
|
||||
"hideEasing": "linear",
|
||||
"showMethod": "fadeIn",
|
||||
"hideMethod": "fadeOut"
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#email_validate_submit").click(async function () {
|
||||
let vaidate_otp;
|
||||
let validate_email = $("#email_validation_input").val();
|
||||
if(validate_email == ''){
|
||||
$('#email_validation_input').addClass('is-invalid')
|
||||
$('#email_validation_input').after(`<div class="invalid-feedback">Please enter Valid email</div>`);
|
||||
return
|
||||
}
|
||||
else{
|
||||
debugger;
|
||||
let port = SERVERNAME;
|
||||
// let port = "http://localhost:3088";
|
||||
let url = `${port}/account/getuserbyphoneormail/${validate_email}/${validate_email}`;
|
||||
const config = {
|
||||
url,
|
||||
method: "get",
|
||||
};
|
||||
$(".loader-btn").show();
|
||||
$('#email_validate_submit').hide()
|
||||
let response = await axios(config);
|
||||
debugger;
|
||||
console.log(response);
|
||||
$(".loader-btn").hide();
|
||||
$('#email_validate_submit').show()
|
||||
if (response.data.result != null) {
|
||||
debugger;
|
||||
console.log(response.data);
|
||||
const forgotpassPayload = {
|
||||
firstname: "",
|
||||
lastname: "",
|
||||
contactnumber: "",
|
||||
email: "",
|
||||
tenantname: "",
|
||||
contactoremail: response.data.result.email,
|
||||
IsSignup: false,
|
||||
IsRegisterUser: false,
|
||||
IsForgotPswd: true,
|
||||
UnibaseId: response.data.result.userName,
|
||||
OtpId: 0,
|
||||
UserOtp: "",
|
||||
};
|
||||
$('#email_validate_submit').hide()
|
||||
$(".loader-btn").show();
|
||||
const validate_email_res = await postAPIService(
|
||||
`account/sendotp`,
|
||||
forgotpassPayload
|
||||
);
|
||||
$(".loader-btn").hide();
|
||||
vaidate_otp = validate_email_res.data;
|
||||
console.log(validate_email_res);
|
||||
$(".email-validation").hide();
|
||||
$('.user_email').html(validate_email)
|
||||
$(".otp-validation .otp-input-group").show();
|
||||
$(".otp-validation .otp-input-group").on("paste", function (p) {
|
||||
let data = p.originalEvent.clipboardData.getData("text");
|
||||
let dataLength = data.length;
|
||||
for (let i = 0; i < dataLength; i++) {
|
||||
let input = $(
|
||||
'.otp-validation .otp-input-group input[tabindex="' + (i + 1) + '"]'
|
||||
);
|
||||
input.val(data.charAt(i));
|
||||
if (input.val().length >= input.attr("maxlength")) {
|
||||
let nextInput = $(
|
||||
'.otp-validation .otp-input-group input[tabindex="' +
|
||||
(i + 2) +
|
||||
'"]'
|
||||
);
|
||||
if (nextInput) {
|
||||
nextInput.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
p.preventDefault();
|
||||
});
|
||||
|
||||
}
|
||||
else{
|
||||
$('#email_validation_input').addClass('is-invalid');
|
||||
$('#email_validation_input').after(`<div class="invalid-feedback">Please enter Valid email</div>`);
|
||||
|
||||
}
|
||||
}
|
||||
$("#email_validate_proceed").click(async function () {
|
||||
debugger;
|
||||
let userotp='';
|
||||
let validate_email = $("#email_validation_input").val();
|
||||
$(".email-validate-div .otp-validation .otp-input-group input").each(function () {
|
||||
let presVal = $(this).val();
|
||||
userotp += presVal;
|
||||
});
|
||||
|
||||
if(userotp.length == 6){
|
||||
const validateForgotpass = {
|
||||
email: validate_email,
|
||||
otpid: vaidate_otp,
|
||||
userotp: userotp,
|
||||
};
|
||||
$('#email_validate_proceed').hide()
|
||||
$(".loader-btn").show();
|
||||
const validate_email_resopt = await postAPIService(
|
||||
`hyperfusion/validateotp`,
|
||||
validateForgotpass
|
||||
);
|
||||
|
||||
$(".loader-btn").hide();
|
||||
$('#email_validate_proceed').show()
|
||||
const Resotp = validate_email_resopt.data.result;
|
||||
if (Resotp == "Otp verified successfully") {
|
||||
$(".login_section").show();
|
||||
$(".otp-validation .otp-input-group").hide();
|
||||
$("#email_validate_back").hide();
|
||||
$('.error_msg').hide();
|
||||
} else {
|
||||
// toasterOpts()
|
||||
// Command: toastr["error"]("Please enter Valid OTP");
|
||||
$('.error_msg').show();
|
||||
$('.error_msg .error_msg_res').html("Please enter Valid OTP");
|
||||
}
|
||||
}
|
||||
else{
|
||||
$('.error_msg').show();
|
||||
$('.error_msg .error_msg_res').html("Please enter OTP");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
initLogin();
|
||||
Ссылка в новой задаче
Block a user