|
@@ -60,6 +60,7 @@ function initLogin() {
|
60
|
60
|
});
|
61
|
61
|
|
62
|
62
|
$("#Login_btn").click(function () {
|
|
63
|
+ $('.error_msg').hide();
|
63
|
64
|
// loginForm.find(".loader-btn").show();
|
64
|
65
|
let userEmail = loginForm.find("#User_Email").val();
|
65
|
66
|
let userPassword = loginForm.find("#User_password").val();
|
|
@@ -103,8 +104,20 @@ function initLogin() {
|
103
|
104
|
};
|
104
|
105
|
let response = await axios(config);
|
105
|
106
|
if (response.data.result == null) {
|
106
|
|
- toasterOpts();
|
107
|
|
- Command: toastr["error"]("Please enter Valid email / password");
|
|
107
|
+ $('.error_msg').show();
|
|
108
|
+ $('.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>`);
|
|
109
|
+ $(".register_sectionbtn").click(function(){
|
|
110
|
+ $(".login_section").css("display","none");
|
|
111
|
+ $(".register_section").css("display","block");
|
|
112
|
+ $(".login_section").find("#User_Email").removeClass("is-invalid");
|
|
113
|
+ $(".login_section").find(".form-floating").removeClass("is-invalid");
|
|
114
|
+ $(".login_section").find("#User_password").removeClass("is-invalid");
|
|
115
|
+ $(".login_section").find(".form-floating").removeClass("is-invalid");
|
|
116
|
+ $('.error_msg').hide();
|
|
117
|
+ });
|
|
118
|
+ // toasterOpts();
|
|
119
|
+
|
|
120
|
+ // Command: toastr["error"]("Please enter Valid email / password");
|
108
|
121
|
} else {
|
109
|
122
|
let userEmail = $("#User_Email").val();
|
110
|
123
|
let userPassword = $("#User_password").val();
|
|
@@ -148,8 +161,16 @@ function initLogin() {
|
148
|
161
|
|
149
|
162
|
window.location.href = `./index.html`;
|
150
|
163
|
} else {
|
151
|
|
- toasterOpts();
|
152
|
|
- Command: toastr["error"](res.data.message)
|
|
164
|
+ $('.error_msg').show();
|
|
165
|
+ $('.error_msg .error_msg_res').html(res.data.message + ' <a class="validate_mail text-danger"><b>Validate Email</b></a>');
|
|
166
|
+ // toasterOpts();
|
|
167
|
+ // Command: toastr["error"]()
|
|
168
|
+ /*Email validation*/
|
|
169
|
+ $('.validate_mail').click(function(){
|
|
170
|
+ $(".login_section").hide();
|
|
171
|
+ $(".email-validate-div").show();
|
|
172
|
+ $('.error_msg').hide();
|
|
173
|
+ })
|
153
|
174
|
}
|
154
|
175
|
}
|
155
|
176
|
}
|
|
@@ -194,8 +215,10 @@ function initLogin() {
|
194
|
215
|
$(".loader-btn").hide();
|
195
|
216
|
$('#register_btn').show()
|
196
|
217
|
if (res.data.code == "404" ) {
|
197
|
|
- toasterOpts();
|
198
|
|
- Command: toastr["error"](res.data.message)
|
|
218
|
+ // toasterOpts();
|
|
219
|
+ // Command: toastr["error"](res.data.message)
|
|
220
|
+ $('.error_msg').show();
|
|
221
|
+ $('.error_msg .error_msg_res').html(res.data.message);
|
199
|
222
|
return;
|
200
|
223
|
}
|
201
|
224
|
else {
|
|
@@ -254,12 +277,16 @@ function initLogin() {
|
254
|
277
|
window.localStorage.setItem("isaccountCreated", true);
|
255
|
278
|
window.location.href = `./index.html`;
|
256
|
279
|
} else {
|
257
|
|
- toasterOpts();
|
258
|
|
- Command: toastr["error"](res.data.message)
|
|
280
|
+ // toasterOpts();
|
|
281
|
+ // Command: toastr["error"](res.data.message)
|
|
282
|
+ $('.error_msg').show();
|
|
283
|
+ $('.error_msg .error_msg_res').html(res.data.message);
|
259
|
284
|
}
|
260
|
285
|
} else {
|
261
|
|
- toasterOpts();
|
262
|
|
- Command: toastr["error"]("Please enter Valid OTP");
|
|
286
|
+ // toasterOpts();
|
|
287
|
+ // Command: toastr["error"]("Please enter Valid OTP");
|
|
288
|
+ $('.error_msg').show();
|
|
289
|
+ $('.error_msg .error_msg_res').html("Please enter Valid OTP");
|
263
|
290
|
}
|
264
|
291
|
});
|
265
|
292
|
}
|
|
@@ -327,7 +354,7 @@ function initLogin() {
|
327
|
354
|
|
328
|
355
|
// function to validate user entered password
|
329
|
356
|
function validatepassword(userPassword) {
|
330
|
|
- var pattern = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{11,}$/;
|
|
357
|
+ var pattern = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,15}$/;
|
331
|
358
|
// return $.trim(userPassword).test(pattern) ? true : false;
|
332
|
359
|
return pattern.test(userPassword) ? true : false;
|
333
|
360
|
}
|
|
@@ -338,6 +365,7 @@ function initLogin() {
|
338
|
365
|
|
339
|
366
|
// this will be triggered on clicking continue in signup form
|
340
|
367
|
$("#register_btn").click(function () {
|
|
368
|
+ $('.error_msg').hide();
|
341
|
369
|
registerForm.find(".loader-btn").show();
|
342
|
370
|
$(this).hide();
|
343
|
371
|
let userEmail = registerForm.find("#User_Email").val();
|
|
@@ -373,9 +401,9 @@ function initLogin() {
|
373
|
401
|
registerForm.find(".loader-btn").hide();
|
374
|
402
|
$(this).show();
|
375
|
403
|
}else if(Pwd_valid === false){
|
376
|
|
- emailInput.find("#User_password").addClass("is-invalid");
|
377
|
|
- emailInput.find(".form-floating").addClass("is-invalid");
|
378
|
|
- emailInput.find(".invalid-feedback").text("Please check the password!");
|
|
404
|
+ passwordInput.find("#User_password").addClass("is-invalid");
|
|
405
|
+ passwordInput.find(".form-floating").addClass("is-invalid");
|
|
406
|
+ passwordInput.find(".invalid-feedback").text("Please check the password!");
|
379
|
407
|
registerForm.find(".loader-btn").hide();
|
380
|
408
|
$(this).show();
|
381
|
409
|
}
|
|
@@ -531,8 +559,10 @@ return
|
531
|
559
|
$(".login-forgot-password-details-div").show();
|
532
|
560
|
$(".otp-validation .otp-input-group").hide();
|
533
|
561
|
} else {
|
534
|
|
- toasterOpts()
|
535
|
|
- Command: toastr["error"]("Please enter Valid OTP");
|
|
562
|
+ // toasterOpts()
|
|
563
|
+ // Command: toastr["error"]("Please enter Valid OTP");
|
|
564
|
+ $('.error_msg').show();
|
|
565
|
+ $('.error_msg .error_msg_res').html("Please enter Valid OTP");
|
536
|
566
|
}
|
537
|
567
|
});
|
538
|
568
|
$("#forgot_password_details_submit").click(async function () {
|
|
@@ -612,5 +642,131 @@ return
|
612
|
642
|
}
|
613
|
643
|
}
|
614
|
644
|
}
|
|
645
|
+ $("#email_validate_submit").click(async function () {
|
|
646
|
+ let vaidate_otp;
|
|
647
|
+ let validate_email = $("#email_validation_input").val();
|
|
648
|
+ if(validate_email == ''){
|
|
649
|
+$('#email_validation_input').addClass('is-invalid')
|
|
650
|
+$('#email_validation_input').after(`<div class="invalid-feedback">Please enter Valid email</div>`);
|
|
651
|
+return
|
|
652
|
+ }
|
|
653
|
+ else{
|
|
654
|
+ debugger;
|
|
655
|
+ let port = "https://beta.bizgaze.app";
|
|
656
|
+ // let port = "http://localhost:3088";
|
|
657
|
+ let url = `${port}/account/getuserbyphoneormail/${validate_email}/${validate_email}`;
|
|
658
|
+ const config = {
|
|
659
|
+ url,
|
|
660
|
+ method: "get",
|
|
661
|
+ };
|
|
662
|
+ $(".loader-btn").show();
|
|
663
|
+ $('#email_validate_submit').hide()
|
|
664
|
+ let response = await axios(config);
|
|
665
|
+ debugger;
|
|
666
|
+ console.log(response);
|
|
667
|
+ $(".loader-btn").hide();
|
|
668
|
+ $('#email_validate_submit').show()
|
|
669
|
+ if (response.data.result != null) {
|
|
670
|
+ debugger;
|
|
671
|
+ console.log(response.data);
|
|
672
|
+ const forgotpassPayload = {
|
|
673
|
+ firstname: "",
|
|
674
|
+ lastname: "",
|
|
675
|
+ contactnumber: "",
|
|
676
|
+ email: "",
|
|
677
|
+ tenantname: "",
|
|
678
|
+ contactoremail: response.data.result.email,
|
|
679
|
+ IsSignup: false,
|
|
680
|
+ IsRegisterUser: false,
|
|
681
|
+ IsForgotPswd: true,
|
|
682
|
+ UnibaseId: response.data.result.userName,
|
|
683
|
+ OtpId: 0,
|
|
684
|
+ UserOtp: "",
|
|
685
|
+ };
|
|
686
|
+ $('#email_validate_submit').hide()
|
|
687
|
+ $(".loader-btn").show();
|
|
688
|
+ const validate_email_res = await postAPIService(
|
|
689
|
+ `account/sendotp`,
|
|
690
|
+ forgotpassPayload
|
|
691
|
+ );
|
|
692
|
+ $(".loader-btn").hide();
|
|
693
|
+ vaidate_otp = validate_email_res.data;
|
|
694
|
+ console.log(validate_email_res);
|
|
695
|
+ $(".email-validation").hide();
|
|
696
|
+ $('.user_email').html(validate_email)
|
|
697
|
+ $(".otp-validation .otp-input-group").show();
|
|
698
|
+ $(".otp-validation .otp-input-group").on("paste", function (p) {
|
|
699
|
+ let data = p.originalEvent.clipboardData.getData("text");
|
|
700
|
+ let dataLength = data.length;
|
|
701
|
+ for (let i = 0; i < dataLength; i++) {
|
|
702
|
+ let input = $(
|
|
703
|
+ '.otp-validation .otp-input-group input[tabindex="' + (i + 1) + '"]'
|
|
704
|
+ );
|
|
705
|
+ input.val(data.charAt(i));
|
|
706
|
+ if (input.val().length >= input.attr("maxlength")) {
|
|
707
|
+ let nextInput = $(
|
|
708
|
+ '.otp-validation .otp-input-group input[tabindex="' +
|
|
709
|
+ (i + 2) +
|
|
710
|
+ '"]'
|
|
711
|
+ );
|
|
712
|
+ if (nextInput) {
|
|
713
|
+ nextInput.focus();
|
|
714
|
+ }
|
|
715
|
+ }
|
|
716
|
+ }
|
|
717
|
+ p.preventDefault();
|
|
718
|
+ });
|
|
719
|
+
|
|
720
|
+ }
|
|
721
|
+ else{
|
|
722
|
+ $('#email_validation_input').addClass('is-invalid');
|
|
723
|
+ $('#email_validation_input').after(`<div class="invalid-feedback">Please enter Valid email</div>`);
|
|
724
|
+
|
|
725
|
+ }
|
|
726
|
+ }
|
|
727
|
+ $("#email_validate_proceed").click(async function () {
|
|
728
|
+ debugger;
|
|
729
|
+ let userotp='';
|
|
730
|
+ let validate_email = $("#email_validation_input").val();
|
|
731
|
+ $(".email-validate-div .otp-validation .otp-input-group input").each(function () {
|
|
732
|
+ let presVal = $(this).val();
|
|
733
|
+ userotp += presVal;
|
|
734
|
+ });
|
|
735
|
+
|
|
736
|
+ if(userotp.length == 6){
|
|
737
|
+ const validateForgotpass = {
|
|
738
|
+ email: validate_email,
|
|
739
|
+ otpid: vaidate_otp,
|
|
740
|
+ userotp: userotp,
|
|
741
|
+ };
|
|
742
|
+ $('#email_validate_proceed').hide()
|
|
743
|
+ $(".loader-btn").show();
|
|
744
|
+ const validate_email_resopt = await postAPIService(
|
|
745
|
+ `hyperfusion/validateotp`,
|
|
746
|
+ validateForgotpass
|
|
747
|
+ );
|
|
748
|
+
|
|
749
|
+ $(".loader-btn").hide();
|
|
750
|
+ $('#email_validate_proceed').show()
|
|
751
|
+ const Resotp = validate_email_resopt.data.result;
|
|
752
|
+ if (Resotp == "Otp verified successfully") {
|
|
753
|
+ $(".login_section").show();
|
|
754
|
+ $(".otp-validation .otp-input-group").hide();
|
|
755
|
+ $("#email_validate_back").hide();
|
|
756
|
+ $('.error_msg').hide();
|
|
757
|
+ } else {
|
|
758
|
+ // toasterOpts()
|
|
759
|
+ // Command: toastr["error"]("Please enter Valid OTP");
|
|
760
|
+ $('.error_msg').show();
|
|
761
|
+ $('.error_msg .error_msg_res').html("Please enter Valid OTP");
|
|
762
|
+ }
|
|
763
|
+ }
|
|
764
|
+ else{
|
|
765
|
+ $('.error_msg').show();
|
|
766
|
+ $('.error_msg .error_msg_res').html("Please enter OTP");
|
|
767
|
+ }
|
|
768
|
+ });
|
|
769
|
+ });
|
|
770
|
+
|
615
|
771
|
|
616
|
772
|
initLogin();
|