From 0cf851936f46c2a15e2a40a15cfd254aab2e8618 Mon Sep 17 00:00:00 2001 From: shakun Date: Tue, 31 Oct 2023 16:59:59 +0545 Subject: [PATCH] merge --- .../AccountBusiness/AccountBusiness.cs | 10 ++-- .../Models/HomeModel/HomeModel.cs | 1 + .../AccountRepository/AccountRepository.cs | 3 +- .../ReceiverRepository/ReceiverRepository.cs | 10 ++-- .../RegisterRepository/RegisterRepository.cs | 1 + .../Controllers/AccountController.cs | 25 +++++--- .../ReceiverInformationController.cs | 4 +- .../Views/Account/ForceChangePassword.cshtml | 13 ++-- .../Views/Account/VerifyOTP.cshtml | 60 +++++++++++++------ .../Customer/CustomerRegistration.cshtml | 44 ++++++++++---- .../Views/ReceiverInformation/Receiver.cshtml | 19 +++--- .../Views/Transaction/Success.cshtml | 14 ++++- 12 files changed, 138 insertions(+), 66 deletions(-) diff --git a/CustomerOnlineV2/CustomerOnlineV2.Business/Business/AccountBusiness/AccountBusiness.cs b/CustomerOnlineV2/CustomerOnlineV2.Business/Business/AccountBusiness/AccountBusiness.cs index 39eb6cf..73ea2fd 100644 --- a/CustomerOnlineV2/CustomerOnlineV2.Business/Business/AccountBusiness/AccountBusiness.cs +++ b/CustomerOnlineV2/CustomerOnlineV2.Business/Business/AccountBusiness/AccountBusiness.cs @@ -135,10 +135,8 @@ namespace CustomerOnlineV2.Business.Business.AccountBusiness { bool emailSent = false; bool smsSent = false; - if (requestOTPModel.userId.IsValidEmail()) - { - if (!string.IsNullOrEmpty(jsonRx.ErrorCode) && jsonRx.ErrorCode.Equals("0")) + if (!string.IsNullOrEmpty(jsonRx.ErrorCode) && (jsonRx.ErrorCode.Equals("0") && jsonRx.Extra3.Equals("100"))) { List bodyMappings = new List(); @@ -191,7 +189,7 @@ namespace CustomerOnlineV2.Business.Business.AccountBusiness StringBuilder s = new StringBuilder(); s.AppendLine($"Dear {jsonRx.Extra}"); - s.AppendLine($"Your OTP code for Customer Registration is {requestOTPModel.OTP}."); + s.AppendLine($"Your OTP code for Customer Registration is {jsonRx.Id}."); s.AppendLine("Regards, IME London"); SMSRequestModel _req = new SMSRequestModel @@ -224,13 +222,13 @@ namespace CustomerOnlineV2.Business.Business.AccountBusiness return jsonRx; } } - } + } else { jsonRx.ErrorCode = "1"; - return new JsonRxResponse { ErrorCode = jsonRx.ErrorCode, Msg = jsonRx.Msg }; + return new JsonRxResponse { ErrorCode = jsonRx.ErrorCode, Msg = jsonRx.Msg , Id= jsonRx.Id, Extra3= jsonRx.Extra3 }; } diff --git a/CustomerOnlineV2/CustomerOnlineV2.Common/Models/HomeModel/HomeModel.cs b/CustomerOnlineV2/CustomerOnlineV2.Common/Models/HomeModel/HomeModel.cs index 4ff7939..9666330 100644 --- a/CustomerOnlineV2/CustomerOnlineV2.Common/Models/HomeModel/HomeModel.cs +++ b/CustomerOnlineV2/CustomerOnlineV2.Common/Models/HomeModel/HomeModel.cs @@ -73,6 +73,7 @@ namespace CustomerOnlineV2.Common.Models.HomeModel { public string Flag { get; set; } public string Value { get; set; } + public string country { get; set; } } public class CommonDropDownList diff --git a/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/AccountRepository/AccountRepository.cs b/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/AccountRepository/AccountRepository.cs index e614bc6..69ed2a0 100644 --- a/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/AccountRepository/AccountRepository.cs +++ b/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/AccountRepository/AccountRepository.cs @@ -140,7 +140,8 @@ namespace CustomerOnlineV2.Repository.Repository.AccountRepository Msg = _dbRes.ResponseMessage, Id = _dbRes.Id, Extra = _dbRes.Extra, - Extra2 = _dbRes.Extra2 + Extra2 = _dbRes.Extra2, + Extra3= _dbRes.ResponseCode.ToString() }; } diff --git a/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/ReceiverRepository/ReceiverRepository.cs b/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/ReceiverRepository/ReceiverRepository.cs index 33dc063..94272d2 100644 --- a/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/ReceiverRepository/ReceiverRepository.cs +++ b/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/ReceiverRepository/ReceiverRepository.cs @@ -42,8 +42,8 @@ namespace CustomerOnlineV2.Repository.Repository.ReceiverRepository sql += ",@lastName1 =" + _connHelper.FilterString(model.lastName1); sql += ",@lastName2 =" + _connHelper.FilterString(model.lastName2); sql += ",@address =" + _connHelper.FilterString(model.Address); - //sql += ",@city =" + _connHelper.FilterString(model.city); - //sql += ",@homePhone =" + _connHelper.FilterString(model.ContactNo); + sql += ",@city =" + _connHelper.FilterString(model.City); + sql += ",@homePhone =" + _connHelper.FilterString(model.homePhone); sql += ",@mobile =" + _connHelper.FilterString(model.Mobile); sql += ",@relationship =" + _connHelper.FilterString(model.Relationship); sql += ",@placeOfIssue =" + _connHelper.FilterString(model.placeOfIssue); @@ -192,7 +192,7 @@ namespace CustomerOnlineV2.Repository.Repository.ReceiverRepository Relationship = Convert.ToString(item["relationship"]), Country = Convert.ToString(item["Country"]), Address = Convert.ToString(item["address"]), - State = Convert.ToString(item["city"]), + City = Convert.ToString(item["city"]), zipCode = Convert.ToString(item["zipCode"]), Mobile = Convert.ToString(item["Mobile"]), Email = Convert.ToString(item["email"]), @@ -276,9 +276,9 @@ namespace CustomerOnlineV2.Repository.Repository.ReceiverRepository { var sql = "EXEC proc_sendPageLoadData"; sql += " @Flag = " + _connHelper.FilterString("rec-select-agent"); - sql += ", @param = " + _connHelper.FilterString("Bank Deposit"); + sql += ", @param = " + _connHelper.FilterString(model.Value); sql += " ,@CountryId = " + _connHelper.FilterString("233"); - sql += " ,@pCountryId = " + _connHelper.FilterString("151"); + sql += " ,@pCountryId = " + _connHelper.FilterString(model.country); _logger.LogDebug("RECEIVERREPOSITORY | GETDDAGENTLLIST | SQL | " + sql); diff --git a/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/RegisterRepository/RegisterRepository.cs b/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/RegisterRepository/RegisterRepository.cs index dd2bff7..1995e36 100644 --- a/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/RegisterRepository/RegisterRepository.cs +++ b/CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/RegisterRepository/RegisterRepository.cs @@ -55,6 +55,7 @@ namespace CustomerOnlineV2.Repository.Repository.RegisterRepository sql += ",@occupation =" + _connHelper.FilterString(model.occupation); sql += ",@custNativecountry =" + _connHelper.FilterString(model.nativeCountry); sql += ",@zipCode =" + _connHelper.FilterString(model.postalCode); + sql += ",@custCity =" + _connHelper.FilterString(model.city); sql += ",@custAdd1 =" + _connHelper.FilterString(model.address); sql += ",@custAdd2 =" + _connHelper.FilterString(model.address2); sql += ",@onlineUser =" + _connHelper.FilterString("true"); diff --git a/CustomerOnlineV2/CustomerOnlineV2/Controllers/AccountController.cs b/CustomerOnlineV2/CustomerOnlineV2/Controllers/AccountController.cs index 99af1f2..d72f3fd 100644 --- a/CustomerOnlineV2/CustomerOnlineV2/Controllers/AccountController.cs +++ b/CustomerOnlineV2/CustomerOnlineV2/Controllers/AccountController.cs @@ -193,6 +193,7 @@ namespace CustomerOnlineV2.Controllers } } + [Authorization("VerifyOTP")] public async Task VerifyOTP(RequestOTPModel requestOTPModel) { requestOTPModel.sessionId = Guid.NewGuid().ToString().Replace("-", ""); @@ -209,23 +210,32 @@ namespace CustomerOnlineV2.Controllers requestOTPModel.requestFor = "REGISTER"; Log.Debug("RequestOTP | REQUEST : " + JsonConvert.SerializeObject(requestOTPModel)); var staticDataResponse = _accountBusiness.RequestOTP(requestOTPModel); - if (staticDataResponse.ErrorCode == "0") - { + var viewModel = new VerifyOtpModel { Email = userEmail, otp = "", }; + if (staticDataResponse.ErrorCode == "0" && staticDataResponse.Extra3.Equals("100")) + { ViewBag.ResponseCode = "0"; ViewBag.ResponseMessage = "OTP has been sent."; return View(viewModel); } else { + if (staticDataResponse.Extra3.Equals("103")) + { + ViewBag.ResponseCode = "103"; + ViewBag.ResponseMessage = "OTP already has been sent."; + return View(viewModel); + } + + ViewBag.ResponseCode = staticDataResponse.ErrorCode; ViewBag.ResponseMessage = staticDataResponse.Msg; _logger.LogError("ACCOUNTCONTROLLER | REQUESTOTP | ERROR OCCURED | " + JsonConvert.SerializeObject(staticDataResponse)); - return View(); + return View(viewModel); } } return View("ErrorViewName"); @@ -244,6 +254,7 @@ namespace CustomerOnlineV2.Controllers { try { + ViewBag.ResponseCode = ""; var loginDetails = HttpContext.GetLoginDetails(); if (string.IsNullOrEmpty(loginDetails.UserName)) @@ -268,14 +279,14 @@ namespace CustomerOnlineV2.Controllers if (response.ErrorCode == "0") { Log.Debug("ACCOUNTCONTROLLER | SubmitOTP | REQUEST ARRIVED | " + loginDetails.Email); - return RedirectToAction("Index", "Home"); + return Ok(new { ErrorCode = response.ErrorCode, ResponseMessage = response.Msg }); } else { - ViewBag.ResponseCode = response.ErrorCode; - ViewBag.ResponseMessage = response.Msg; + //ViewBag.ResponseCode = response.ErrorCode; + //ViewBag.ResponseMessage = response.Msg; _logger.LogError("ACCOUNTCONTROLLER | LOGIN | ERROR OCCURRED | " + JsonConvert.SerializeObject(response)); - return View(); + return Ok(new { ErrorCode = response.ErrorCode, ResponseMessage =response.Msg }); } } } diff --git a/CustomerOnlineV2/CustomerOnlineV2/Controllers/ReceiverInformationController.cs b/CustomerOnlineV2/CustomerOnlineV2/Controllers/ReceiverInformationController.cs index 2934f6c..0b784fa 100644 --- a/CustomerOnlineV2/CustomerOnlineV2/Controllers/ReceiverInformationController.cs +++ b/CustomerOnlineV2/CustomerOnlineV2/Controllers/ReceiverInformationController.cs @@ -77,8 +77,8 @@ namespace CustomerOnlineV2.Controllers } [HttpPost] [ValidateAntiForgeryToken] - [Authorization("GetDDLList")] - public async Task GetDDLList(CommonDropDownModel model) + [Authorization("GetDDAgentLList")] + public async Task GetDDAgentLList(CommonDropDownModel model ) { var loginDetails = HttpContext.GetLoginDetails(); return await _receiverBusiness.GetDDLList(model, loginDetails); diff --git a/CustomerOnlineV2/CustomerOnlineV2/Views/Account/ForceChangePassword.cshtml b/CustomerOnlineV2/CustomerOnlineV2/Views/Account/ForceChangePassword.cshtml index 2591f62..b2e65d3 100644 --- a/CustomerOnlineV2/CustomerOnlineV2/Views/Account/ForceChangePassword.cshtml +++ b/CustomerOnlineV2/CustomerOnlineV2/Views/Account/ForceChangePassword.cshtml @@ -194,7 +194,9 @@ $(document).ready(function () { debugger; - // Select the password and confirmPassword input fields + + + var passwordField = $("#NewPassword"); var confirmPasswordField = $("#ConfirmNewPassword"); @@ -210,8 +212,9 @@ var password = passwordField.val(); if (passwordRegex.test(password)) { - passwordValidation.text("Valid password").css("color", "green"); + passwordValidation.text("Valid password").removeClass("text-danger").addClass("text-success"); } else { + passwordValidation.text("Valid password").removeClass("text-success").addClass("text-danger"); passwordValidation.text("Password should contain at least one special character (*&%$), one uppercase, one lowercase and min of 8 characters").css("color", "red"); } }); @@ -221,11 +224,13 @@ var confirmPassword = confirmPasswordField.val(); if (password === confirmPassword) { - confirmPasswordValidation.text("Passwords match").css("color", "green"); + confirmPasswordValidation.text("Passwords match").removeClass("text-danger").addClass("text-success"); } else { - confirmPasswordValidation.text("Passwords do not match").css("color", "red"); + + confirmPasswordValidation.text("Passwords do not match").removeClass("text-success").addClass("text-danger"); } }); + }) diff --git a/CustomerOnlineV2/CustomerOnlineV2/Views/Account/VerifyOTP.cshtml b/CustomerOnlineV2/CustomerOnlineV2/Views/Account/VerifyOTP.cshtml index 9d5e4b0..3036150 100644 --- a/CustomerOnlineV2/CustomerOnlineV2/Views/Account/VerifyOTP.cshtml +++ b/CustomerOnlineV2/CustomerOnlineV2/Views/Account/VerifyOTP.cshtml @@ -86,7 +86,7 @@
- +
@@ -107,7 +107,7 @@
-
@@ -183,25 +183,40 @@ $(document).ready(function () { - if ('@ViewBag.ResponseCode' != '0') { - iziToast.error({ - title: 'Error', + if ('@ViewBag.ResponseCode' == '0') { + iziToast.success({ + title: 'OK', message: '@ViewBag.ResponseMessage' }); } - else { - iziToast.success({ - title: 'OK', + else if ('@ViewBag.ResponseCode' == '103') { + iziToast.info({ + title: 'Info', + message: '@ViewBag.ResponseMessage' + }); + } + else if ('@ViewBag.ResponseCode' == '1') { + iziToast.error({ + title: 'Error', message: '@ViewBag.ResponseMessage' }); } - }); function SubmitOTP() { + + let email = $('#Email').val(); let otp = $('#otp').val(); + + if (otp.length === 0) { + iziToast.error({ + title: 'Error', + message: 'OTP field is required' + }); + return; + } let Data = { Email: email, @@ -222,21 +237,28 @@ }, async: true, success: function (response) { - + debugger; if (response.errorCode == 0) { - debugger - ShowAlertMessage(response.errorCode, response.msg); - window.location.replace("/home"); + iziToast.info({ + title: 'OK', + onClosed: function () { + window.location.replace("/home"); + } + }); } else { - debugger - ShowAlertMessage(response.errorCode, response.msg); + iziToast.error({ + title: 'Error', + message: response.responseMessage + }); } }, - - error: function () { - ShowAlertMessage(response.errorCode, response.msg); + error: function () { + iziToast.error({ + title: 'Error', + message: response.responseMessage + }); } }); } @@ -249,7 +271,7 @@ // alert("Action canceled"); } } - + diff --git a/CustomerOnlineV2/CustomerOnlineV2/Views/Customer/CustomerRegistration.cshtml b/CustomerOnlineV2/CustomerOnlineV2/Views/Customer/CustomerRegistration.cshtml index dd8012a..34442b0 100644 --- a/CustomerOnlineV2/CustomerOnlineV2/Views/Customer/CustomerRegistration.cshtml +++ b/CustomerOnlineV2/CustomerOnlineV2/Views/Customer/CustomerRegistration.cshtml @@ -213,7 +213,7 @@ SN Address1 - Address2 + City Action @@ -235,6 +235,14 @@
+
+
+
+ + +
+
+
@@ -339,6 +347,9 @@ + + + @* *@