diff --git a/dist/Js/auth/apiservice.js b/dist/Js/auth/apiservice.js index e7d3a98..48599c5 100644 --- a/dist/Js/auth/apiservice.js +++ b/dist/Js/auth/apiservice.js @@ -1,9 +1,8 @@ -let SERVERNAME = 'https://anwi.bizgaze.app'; -const STAT = '05b2f2ca510344968c65e1ebf49a5595'; - - - -async function postStatAPIService(url,data={}){ +// let SERVERNAME = 'https://anwi.bizgaze.app'; +let SERVERNAME = 'https://beta.bizgaze.app'; +//let SERVERNAME = 'http://localhost:3088'; +const STAT = 'b276960fddf84e8cb63de6e32d31529b'; +async function getStatAPIService(url,data={}){ let config = { url, method:'get', @@ -17,3 +16,305 @@ async function postStatAPIService(url,data={}){ return response; } + +async function postStatAPIService(url,data={}){ + let config = { + url, + method:'post', + data:data, + headers: { + 'Authorization': `stat ${STAT}`, + 'Content-Type': 'application/json' + }, + } + let response = await axios(config); + + return response; +} + + +async function postAPIServiceWarranty(url,data={}){ + let SERVERURL = 'https://anwi.bizgaze.app'; + let config = { + url:`${SERVERURL}/${url}`, + method:'post', + data:data, + headers: { + 'Authorization': `Basic 6cdcfe22-1623-4740-97e0-363d518c0e8a`, + 'Content-Type': 'application/json' + }, + } + let response = await axios(config); + + return response; +} +async function postAPIService(url,data={}){ + let SERVERURL = 'https://beta.bizgaze.app'; + //let SERVERURL = 'http://localhost:3088'; + let config = { + url:`${SERVERURL}/${url}`, + method:'post', + data:data, + } + let response = await axios(config); + + return response; +} + + +async function postAPIServiceLocal(url,data={}){ + let config = { + url:`${SERVERNAME}/${url}`, + method:'post', + data:JSON.stringify(data), + headers: { + 'Authorization': `Basic c86af480-b5ef-43af-8ce9-503e5b831e2e`, + 'Content-Type': 'application/json' + }, + } + let response = await axios(config); + + return response; +} +async function getAPIServiceLocal(url){ + let SERVERURL = 'https://anwi.bizgaze.app'; + let config = { + url:`${SERVERURL}/${url}`, + method:'get', + headers: { + 'Authorization': `Basic ed40b74d-561a-47af-b03b-4f29c5ff6937`, + 'Content-Type': 'application/json' + }, + } + let response = await axios(config); + + return response; +} + + +class API_SERVICE_CLASS{ + baseURL = ''; + token=''; + statToken=STAT; + Instance = null; + + constructor(baseurl){ + this.Instance = this; + this.baseURL = baseurl; + + this.getService = this.getService.bind(this); + this.postService = this.postService.bind(this); + this.justGetAPIService =this.justGetAPIService.bind(this); + this.justPostAPIService = this.justPostAPIService.bind(this); + + } + + getService(url,isStat = false){ + return this.baseService(this.buildURL(url),'get',isStat); + } + + postService(url,data,isStat = false){ + return this.baseService(this.buildURL(url),'post',isStat,data); + } + + + + async baseService(url,method,isStat,data){ + let isPost = method == 'get' ? false : true; + const cookieData = COOKIE_HELPER_ACTIONS.getCookie(); + if(!isStat){ + if(!cookieData) return window.location.href = "/" + } + let token = isStat ?`stat ${this.statToken}` : `Basic ${cookieData.token}`; + // let token = isStat ?`stat ${this.statToken}` : `Basic ${this.token}`; + let successResFun = this.buildSuccessResponse; + let failureResFun = this.buildFailureResponse; + let config = { + url, + method, + headers:{ + 'Authorization': token, + 'Content-Type': 'application/json' + } + } + + if(isPost){ + config['data'] = data; + } + + try { + let response + try { + response = await axios(config); + if(response.data === true || response.data === false){ + return successResFun(response.data) + } + if(response.data.code == '417'){ + window.location.href = '/index.html' + return failureResFun(response.data) + } + if(response.data.code != '0'){ + return failureResFun(response.data) + } + return successResFun(response.data) + + } catch (error) { + return failureResFun(error) + } + + } catch (error) { + return failureResFun(error) + } + + } + + + buildURL(url){ + return `${this.baseURL}/${url}`; + } + + buildSuccessResponse(response){ + return { + isError : false, + errorMsg : null, + response:response, + } + } + + buildFailureResponse(error){ + return { + isError : true, + errorMsg : error, + response:null, + } + } + + async justAPI_BaseService(){ + let isPost = method == 'get' ? false : true; + + + let successResFun = this.buildSuccessResponse; + let failureResFun = this.buildFailureResponse; + let config = { + url, + method, + headers:{ + + 'Content-Type': 'application/json' + } + } + + if(isPost){ + config['data'] = data; + } + + try { + let response + try { + response = await axios(config); + if(response.data.code == '417'){ + // window.location.href = '/index.html' + return failureResFun(response.data) + } + if(response.data.code != '0'){ + return failureResFun(response.data) + } + return successResFun(response.data) + + } catch (error) { + return failureResFun(error) + } + + } catch (error) { + return failureResFun(error) + } + } + + justGetAPIService(url){ + return this.justAPI_BaseService('get',url) + } + justPostAPIService(url){ + return this.justAPI_BaseService('post',url) + } + + + isValid(){ + const cookieData = COOKIE_HELPER_ACTIONS.getCookie(); + if(!cookieData){ + return justGetAPIService('/Account/Session/Validate') + } + } + + +} + +const API_SERVICES = new API_SERVICE_CLASS(SERVERNAME); + +const API_SERVICES_ACTIONS = { + postAPIService:API_SERVICES.postService, + getAPIService:API_SERVICES.getService +} + + +// cookie helper +const AUTH = 'AUTH' + +class COOKIE_HELPER_CLASS{ + constructor(){ + this.getCookie = this.getCookie.bind(this); + } + getCookie(){ + let cookieVal = Cookies.get(AUTH); + if(!cookieVal){ + return null; + } + return JSON.parse(cookieVal) + }; + setCookie(value){ + debugger; + return Cookies.set(AUTH,value) + }; + + removeCookie(token){ + Cookies.remove(token) +} + async validateToken() { + return await API_SERVICES_ACTIONS.getAPIService(`Account/Session/Validate`) + } +} + + +const COOKIE_HELPER = new COOKIE_HELPER_CLASS(); +const COOKIE_HELPER_ACTIONS ={ + getCookie : COOKIE_HELPER.getCookie, + setCookie :COOKIE_HELPER.setCookie, + removeAuthCookie:COOKIE_HELPER.removeCookie.bind(null,AUTH) +} +function setCookieManual(token){ + Cookies.set(AUTH,{ + token, + userId:null + }) +} + +async function checkValidAuth(cb,redirect=undefined){ + debugger; + document.querySelector('auth-loader').show(); + const res = await COOKIE_HELPER.validateToken(); + debugger + if(!res.response){ + if(redirect){ + window.location.href =redirect; + document.querySelector('auth-loader').hide(); + return; + } + window.location.href = '/'; + document.querySelector('auth-loader').hide(); + return; + } + + setTimeout(()=>{ + document.querySelector('auth-loader').hide(); + cb(); + },300); +} diff --git a/dist/Js/auth/login.js b/dist/Js/auth/login.js index 85d5215..094f034 100644 --- a/dist/Js/auth/login.js +++ b/dist/Js/auth/login.js @@ -1,8 +1,597 @@ +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"); -function authFunction(){ - console.log("hello"); - postAPIService() + $("#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 () { + // 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 = "https://beta.bizgaze.app"; + // 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) { + 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, + }); + // setInitLoginLocal(); + window.localStorage.setItem("Useremail", userEmail); + //window.localStorage.setItem("Userpassword", userPassword); + window.localStorage.setItem("Isloggedintoaster", true); + window.localStorage.setItem("Isloggedin", true); + window.location.href = `./index.html`; + } else { + toasterOpts(); + Command: toastr["error"](res.data.message) + } + } + } + + // 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) + 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, + }); + // setInitLoginLocal(); + window.localStorage.setItem("Useremail", userEmail); + //window.localStorage.setItem("Userpassword", userPassword); + window.localStorage.setItem("isaccountCreated", true); + window.location.href = `./index.html`; + } else { + toasterOpts(); + Command: toastr["error"](res.data.message) + } + } else { + toasterOpts(); + Command: toastr["error"]("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).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) $("#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) && validatepassword(userPassword)) { + userRegistration(); + $("#register_form .otp-input-group .otp-sent-email").text(userEmail); + } 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(); + } + } + }); + $(".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(`
Please enter Valid email
`); +return + } + else{ + debugger; + let port = "https://beta.bizgaze.app"; + // 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"); + } + }); + $("#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(`
Please enter Valid email
`); + + } + } + }); + $(".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" + } + } } -authFunction(); \ No newline at end of file +initLogin(); diff --git a/dist/Js/footer.js b/dist/Js/footer.js index e766313..928333e 100644 --- a/dist/Js/footer.js +++ b/dist/Js/footer.js @@ -218,7 +218,7 @@ $(document).ready(function () {