Tento commit je obsažen v:
2023-05-25 12:32:11 +05:30
rodič c2f6fbdb94
revize 60ea1797f1
43 změnil soubory, kde provedl 2938 přidání a 1006 odebrání
+12 -5
Zobrazit soubor
@@ -4,19 +4,25 @@ let SERVERNAME = 'https://qa.anwisystems.com';
//let SERVERNAME = 'http://localhost:3088';
//template
const STAT = 'd622a6ce4c8540ffadd0f885162ac8f4';
const STAT = 'd8c3dc7ce4d2404484004c02d1d3145f';
//live
//const STAT = '0c7ef2b000ca431290065753dfda56fe';
//const STAT = '23bdb3c6d08d492c939a53daec34e89a';
const USER_AUTH_OKAY = 'USER_AUTH_OKAY';
function imgServerNameBuild(path){
return `https://appassets.bizgaze.app/${path}`;
}
function buildLinkWithServerName(link){
return `${SERVERNAME}/${link}`
}
async function getStatAPIService(url,data={}){
let config = {
url,
@@ -33,7 +39,7 @@ async function getStatAPIService(url,data={}){
}
async function getAPIService(url,data={}){
debugger
const config = {
url:`${SERVERNAME}/${url}`,
method: "get",
@@ -135,7 +141,7 @@ class API_SERVICE_CLASS{
let isPost = method == 'get' ? false : true;
const cookieData = COOKIE_HELPER_ACTIONS.getCookie();
if(!isStat){
if(!cookieData) return window.location.href = "/"
if(!cookieData) return window.location.href = "login.html"
}
let token = isStat ?`stat ${this.statToken}` : `Basic ${cookieData.token}`;
this.token = token;
@@ -295,6 +301,7 @@ class COOKIE_HELPER_CLASS{
};
removeCookie(token){
debugger;
Cookies.remove(token)
}
@@ -321,7 +328,7 @@ function setCookieManual(token){
}
async function checkValidAuth(cb,redirect=undefined){
debugger;
document.querySelector('auth-loader').show();
const res = await COOKIE_HELPER.validateToken();
+41 -22
Zobrazit soubor
@@ -97,7 +97,7 @@ function initLogin() {
function updatePasswordUI() {
formErrorAction.removeClass();
let html = ` <form class="row g-3 needs-validation" novalidate> <div class="form-floating position-relative py-0"> <input required type="password" class="form-control shadow-none h-50p passwordvalidui" id="updatepassword" placeholder="Enter Your Password" autocomplete="off"> <span class="position-absolute eyePassword" style=" top: 50%; right: 3%; transform: translateY(-50%);"> <i class="text-dark fa fa-eye-slash"></i> </span> <label for="updatepassword">Password </label> <div class="invalid-feedback"> Please enter password. </div> <div class="pswd_info" style="display: none;z-index: 1;"> <p>Password must contain:</p> <ul> <li id="chck_capital" class="invalid">At least <strong>one capital letter</strong> </li> <li id="chck_small" class="invalid">At least <strong>one lowercase letter</strong> </li> <li id="chck_special" class="invalid">At least <strong>one special letter</strong> </li> <li id="chck_number" class="invalid">At least <strong>one number</strong> </li> <li id="chck_length" class="invalid">At least <strong>8 characters</strong> </li> </ul> </div> </div> <div class="form-floating position-relative py-0"> <input required type="password" class="form-control shadow-none h-50p passwordvalidui" id="updateconfirmpassword" placeholder="Enter Your Password" autocomplete="off"> <span class="position-absolute eyePassword" style=" top: 50%; right: 3%; transform: translateY(-50%);"> <i class="text-dark fa fa-eye-slash"></i> </span> <label for="updateconfirmpassword">Password </label> <div class="invalid-feedback"> Please enter password. </div> <div class="pswd_info" style="display: none;z-index: 1;"> <p>Password must contain:</p> <ul> <li id="chck_capital" class="invalid">At least <strong>one capital letter</strong> </li> <li id="chck_small" class="invalid">At least <strong>one lowercase letter</strong> </li> <li id="chck_special" class="invalid">At least <strong>one special letter</strong> </li> <li id="chck_number" class="invalid">At least <strong>one number</strong> </li> <li id="chck_length" class="invalid">At least <strong>8 characters</strong> </li> </ul> </div> </div> <div class="col-12 pt-3 mt-0 px-0"> <button class="btn bg-gradient-anwi text-white w-100 cursor-pointer btnupdatepassword" type="submit"> <div class="spinner-border authloginLoadingBtn d-none" role="status"> <span class="visually-hidden">Loading...</span> </div> <span class="authloginLoading">Update Password</span> </button> </div> </form>`;
let html = ` <form class="row g-3 needs-validation" novalidate> <div class="form-floating position-relative py-0"> <input required type="password" class="form-control shadow-none h-50p passwordvalidui" id="updatepassword" placeholder="Enter Your Password" autocomplete="off"> <span class="position-absolute eyePassword" style=" top: 50%; right: 3%; transform: translateY(-50%);"> <i class="text-dark fa fa-eye-slash"></i> </span> <label for="updatepassword">Password </label> <div class="invalid-feedback"> Please enter password. </div> <div class="pswd_info" style="display: none;z-index: 1;"> <p>Password must contain:</p> <ul> <li id="chck_capital" class="invalid">At least <strong>one capital letter</strong> </li> <li id="chck_small" class="invalid">At least <strong>one lowercase letter</strong> </li> <li id="chck_special" class="invalid">At least <strong>one special letter</strong> </li> <li id="chck_number" class="invalid">At least <strong>one number</strong> </li> <li id="chck_length" class="invalid">At least <strong>8 characters</strong> </li> </ul> </div> </div> <div class="form-floating position-relative py-0"> <input required type="password" class="form-control shadow-none h-50p passwordvalidui" id="updateconfirmpassword" placeholder="Enter Your Password" autocomplete="off"> <span class="position-absolute eyePassword" style=" top: 50%; right: 3%; transform: translateY(-50%);"> <i class="text-dark fa fa-eye-slash"></i> </span> <label for="updateconfirmpassword">Password </label> <div class="invalid-feedback"> Please enter password. </div> <div class="pswd_info" style="display: none;z-index: 1;"> <p>Password must contain:</p> <ul> <li id="chck_capital" class="invalid">At least <strong>one capital letter</strong> </li> <li id="chck_small" class="invalid">At least <strong>one lowercase letter</strong> </li> <li id="chck_special" class="invalid">At least <strong>one special letter</strong> </li> <li id="chck_number" class="invalid">At least <strong>one number</strong> </li> <li id="chck_length" class="invalid">At least <strong>8 characters</strong> </li> </ul> </div> </div> <div class="col-12 pt-3 mt-0 px-0"> <button class="btn bg-gradient-anwi text-white w-100 cursor-pointer h-50p btnupdatepassword" type="submit"> <div class="spinner-border authloginLoadingBtn d-none" role="status"> <span class="visually-hidden">Loading...</span> </div> <span class="authloginLoading">Update Password</span> </button> </div> </form>`;
$('.authContainerUI').html(html);
updatepasswordEvents();
@@ -151,7 +151,7 @@ function initLogin() {
function loadPasswordListener(){
$('.passwordvalidui').off().on('keyup',function (e){
debugger;
$(this).parent().find('.pswd_info').css('display','block');
let value = $(this).val();
@@ -268,7 +268,7 @@ function initLogin() {
function forgotPasswordUIEmail() {
formErrorAction.removeClass();
let html = `<div> <div class="d-flex justify-content-between border-bottom pb-1"><span>Forgot Password?</span><span class="btnForgotback cursor-pointer"><i class="fa-solid fa-arrow-left"></i></span></div> <div class="py-3">Enter the email associated with your account and we'll send an email with instructions to reset your password.</div> <div> <form class="row g-3 needs-validation" novalidate> <div class="pb-3 form-floating py-0"> <input required type="email" class="form-control shadow-none h-50p" id="forgotpassword" placeholder="Enter Your Email" autocomplete="off"> <label for="forgotpassword">Email address</label> <div class="invalid-feedback"> Please enter email. </div> </div> <div class="col-12 mt-0 px-0"> <button class="btn forgotpasswordbtn bg-gradient-anwi text-white w-100 cursor-pointer" type="submit"> <div class="spinner-border authloginLoadingBtn d-none" role="status"> <span class="visually-hidden">Loading...</span> </div> <span class="authloginLoading">Find email</span> </button> </div> </form> </div></div>`;
let html = `<div> <div class="d-flex justify-content-between border-bottom pb-1"><span>Forgot Password?</span><span class="btnForgotback cursor-pointer"><i class="fa-solid fa-arrow-left"></i></span></div> <div class="py-3">Enter the email associated with your account and we'll send an email with instructions to reset your password.</div> <div> <form class="row g-3 needs-validation" novalidate> <div class="pb-3 form-floating py-0"> <input required type="email" class="form-control shadow-none h-50p" id="forgotpassword" placeholder="Enter Your Email" autocomplete="off"> <label for="forgotpassword">Email address</label> <div class="invalid-feedback"> Please enter email. </div> </div> <div class="col-12 mt-0 px-0"> <button class="btn h-50p forgotpasswordbtn bg-gradient-anwi text-white w-100 cursor-pointer" type="submit"> <div class="spinner-border authloginLoadingBtn d-none" role="status"> <span class="visually-hidden">Loading...</span> </div> <span class="authloginLoading ">Password Reset</span> </button> </div> </form> </div></div>`;
$('.authContainerUI').html(html);
loadForpasswordsEvents();
}
@@ -288,7 +288,7 @@ function initLogin() {
return;
}
debugger;
const email = $('#User_Email').val();
const isUserURL = AUTH_LOGIN_APIS_URL.isUser(email);
@@ -299,6 +299,7 @@ function initLogin() {
if (!isUser) {
loginUser();
} else {
debugger;
signUpUser();
}
});
@@ -368,12 +369,21 @@ function initLogin() {
authloginLoadingBtnAction.removeLoading();
return;
}
COOKIE_HELPER_ACTIONS.setCookie({
let authObj = {
token: res.result.sessionId,
userid: res.result.userId,
...res.result
});
userId: res.result.userId,
unibaseId:res.result.unibaseId,
sessionId:res.result.sessionId,
tenantId:res.result.tenantId,
name:res.result.name,
assetUrl:res.result.assetUrl
};
COOKIE_HELPER_ACTIONS.setCookie(authObj);
localStorage.setItem("userdata",JSON.stringify(res.result));
const isCartAdded = localStorage.getItem(CART_ADD);
if(isCartAdded){
@@ -438,6 +448,8 @@ function initLogin() {
formErrorAction.addError('Password must contain one specail letter ,number,small letter, uppercase letter and 8 letters');
return;
}
const userRegistratioNPayload = {
organizationtypeid: "2",
organizationid: "0",
@@ -487,7 +499,7 @@ function initLogin() {
function loginUI() {
formErrorAction.removeClass();
let html = ` <div class="text-center pb-4">
<span class="font-weight-600">Sign Up</span> or <span class="font-weight-600">Login</span>
<span class="font-weight-600">Login</span> / <span class="font-weight-600">Signup</span>
</div>
<form class="row g-3 needs-validation" novalidate>
<div class="form-floating py-0">
@@ -520,11 +532,11 @@ function initLogin() {
</div>
<div class="fs-7 my-2 satoshi_font text-center"> By continuing, I agree to the Terms of Use & Privacy Policy </div>
<div class="col-12 mt-0 px-0">
<button class="btn bg-gradient-anwi text-white w-100 cursor-pointer" type="submit">
<button class="btn bg-gradient-anwi text-white w-100 cursor-pointer h-50p" type="submit">
<div class="spinner-border authloginLoadingBtn d-none" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<span class="authloginLoading">Continue</span>
<span class="authloginLoading h-50p">Continue</span>
</button>
</div>
</form>
@@ -544,8 +556,8 @@ function initLogin() {
<span class="btnForgotback">
<i class="fa-solid fa-arrow-left"></i>
</span>
</div> <div class="otp-validation"> <div class="otp-input-group mt-3"> <div> <h4 class="text-center">Enter OTP</h4> <div class="text-center">we have sent an OTP to this Email </div> <p class="user_email text-center"></p> <div class="otp-sent-email fw-600 text-center"></div> </div> <div class="d-flex my-4"> <div class="col"> <div class="form-group"> <input type="text" class="press form-control" name="code" maxlength="1" tabindex="1" autocomplete="off"> </div> </div> <div class="col"> <div class="form-group"> <input type="text" class="press form-control" name="code" maxlength="1" tabindex="2" autocomplete="off"> </div> </div> <div class="col"> <div class="form-group"> <input type="text" class="press form-control" name="code" maxlength="1" tabindex="3" autocomplete="off"> </div> </div> <div class="col"> <div class="form-group"> <input type="text" class="press form-control" name="code" maxlength="1" tabindex="4" autocomplete="off"> </div> </div> <div class="col"> <div class="form-group"> <input type="text" class="press form-control" name="code" maxlength="1" tabindex="5" autocomplete="off"> </div> </div> <div class="col"> <div class="form-group"> <input type="text" class="press form-control" name="code" maxlength="1" tabindex="6" autocomplete="off"> </div> </div> </div> <div> <div class="btn bg-gradient-anwi w-100 loader-btn" style="display: none;"> <span class="loader"></span> </div> <a href="#" class="bg-gradient-anwi btn fw-500 text-white w-100" id="email_validate_proceed" type="submit"><div class="spinner-border otploading d-none" role="status">
</div><span class="otploadingtext">CONFIRM</span></a> </div> <div class="resendOTP cursor-pointer text-center pt-4 font-weight-600">Resend OTP</div> </div></div>`;
</div> <div class="otp-validation"> <div class="otp-input-group mt-3"> <div> <h4 class="text-center">Enter OTP</h4> <div class="text-center">We have send OTP to your email </div> <p class="user_email text-center"></p> <div class="otp-sent-email fw-600 text-center"></div> </div> <div class="d-flex my-4"> <div class="col"> <div class="form-group"> <input type="text" class="press form-control" name="code" maxlength="1" tabindex="1" autocomplete="off"> </div> </div> <div class="col"> <div class="form-group"> <input type="text" class="press form-control" name="code" maxlength="1" tabindex="2" autocomplete="off"> </div> </div> <div class="col"> <div class="form-group"> <input type="text" class="press form-control" name="code" maxlength="1" tabindex="3" autocomplete="off"> </div> </div> <div class="col"> <div class="form-group"> <input type="text" class="press form-control" name="code" maxlength="1" tabindex="4" autocomplete="off"> </div> </div> <div class="col"> <div class="form-group"> <input type="text" class="press form-control" name="code" maxlength="1" tabindex="5" autocomplete="off"> </div> </div> <div class="col"> <div class="form-group"> <input type="text" class="press form-control" name="code" maxlength="1" tabindex="6" autocomplete="off"> </div> </div> </div> <div> <a href="#" class=" h-50p d-flex align-items-center justify-content-center bg-gradient-anwi btn fw-500 text-white w-100" id="email_validate_proceed" type="submit"><div class="spinner-border otploading d-none" role="status">
</div><span class="otploadingtext">Verfiy OTP</span></a> </div> <div class="resendOTP cursor-pointer text-center pt-4 ">Resend OTP</div> </div></div>`;
$('.authContainerUI').html(html);
loadOTPEvents(forgot);
}
@@ -592,7 +604,7 @@ function initLogin() {
let presVal = $(this).val();
userotp += presVal;
});
debugger;
if (userotp.length == 6) {
// const validateForgotpass = {
// email: userDetails.email,
@@ -615,14 +627,21 @@ function initLogin() {
toasterHelper("success", "Email has been verified");
return;
}
const res = await loginUserService(userDetails.email, userDetails.password);
let res = await loginUserService(userDetails.email, userDetails.password);
res = res.data;
COOKIE_HELPER_ACTIONS.setCookie({
token: res.data.result.sessionId,
userid: res.data.result.userId,
...res.data.result
});
let authObj = {
token: res.result.sessionId,
userId: res.result.userId,
unibaseId:res.result.unibaseId,
sessionId:res.result.sessionId,
tenantId:res.result.tenantId,
name:res.result.name,
assetUrl:res.result.assetUrl
};
COOKIE_HELPER_ACTIONS.setCookie(authObj);
localStorage.setItem("userdata",JSON.stringify(res.result));
const isCartAdded = localStorage.getItem(CART_ADD);
if(isCartAdded){
localStorage.removeItem(CART_ADD);