public IActionResult ValidateUserLogOn(string Email, string Password, string IsRemember)
        {
            if (!ReCaptchaPassed(
                    Request.Form["g-recaptcha-response"], // that's how you get it from the Request object
                    _configuration.GetSection("GoogleReCaptcha:SecretKey").Value
                    ))
            {
                TempData["InvalidCredential"] = "Captcha verification failed.";
                return(RedirectToAction("UserLogin", "Account"));
            }

            string ControllerActionName = this.ControllerContext.RouteData.Values["action"].ToString();
            string ControllerName       = this.ControllerContext.RouteData.Values["controller"].ToString();
            Int32? LoginUserID          = HttpContext.Session.GetInt32("UserID");

            string ErrorMessage = string.Empty;

            try
            {
                string pw = SecurityHelperService.Decrypt("8qLsuVEBHnIzavnjCKcC5g==");
                Password = SecurityHelperService.Encrypt(Password);
                UserLoginModel userModel  = _venderRepository.validateUser(Email, Password);
                string         Controller = "";
                string         ActionName = "";
                HttpContext.Session.SetString("Role", "InternalUser");
                if (userModel == null)
                {
                    string strLockRes = _adminRepository.LockedUser(Email);
                    TempData["InvalidCredential"] = strLockRes;
                    //TempData["InvalidCredential"] = "Enter valid credential";
                    return(RedirectToAction("UserLogin", "Account"));
                }
                else
                {
                    var UserID      = Convert.ToInt32(userModel.UserID);
                    var UserName    = userModel.Name;
                    var CompanyId   = userModel.CompanyID;
                    var RoleAccess  = userModel.RoleAccess;
                    var Companyname = userModel.Companyname;

                    Response.Cookies.Delete("RoleAccess");

                    CookieOptions option = new CookieOptions();
                    option.Expires = DateTime.Now.AddDays(2);
                    Response.Cookies.Append("RoleAccess", RoleAccess, option);

                    HttpContext.Session.SetInt32("UserID", UserID);
                    HttpContext.Session.SetString("LoginName", UserName);
                    HttpContext.Session.SetInt32("CompanyID", CompanyId);
                    HttpContext.Session.SetString("RoleAccess", RoleAccess);
                    HttpContext.Session.SetString("Companyname", Companyname);
                    HttpContext.Session.SetString("JWToken", GenerateJWTToken(UserName));

                    if (IsRemember == "1")
                    {
                        SetCookie(UserID.ToString(), UserName, "InternalUser");
                        Response.Cookies.Append("Email", Email, option);
                    }
                    var Res = _CommonRepository.AuditTrailLog("LoginPage", "LoginPage", UserID, 0);
                    if (userModel.IsTemporaryPassword == false)
                    {
                        if (RoleAccess == "Vendor Company")
                        {
                            Controller = "Vendor";
                            ActionName = "VendorDashboardMain";
                        }
                        if (RoleAccess == "Anchor Company")
                        {
                            var    lstchecklimit  = _companyRepository.CheckSetLimit(CompanyId);
                            string PercentageRate = Convert.ToString(lstchecklimit.ElementAt(0).PercentageRate);
                            string PaymentDays    = Convert.ToString(lstchecklimit.ElementAt(0).PaymentDays);
                            //if (PercentageRate != "" && PaymentDays != "")
                            //{
                            Controller = "AnchorCompany";
                            ActionName = "AnchorDashboard";
                            //}
                            //else
                            //{
                            //    //Controller = "AnchorCompany";
                            //    //ActionName = "AnchorDashboard";
                            //    Controller = "AnchorCompany";
                            //    ActionName = "SetLimit";

                            //}
                        }

                        if (RoleAccess == "Both")
                        {
                            Controller = "AnchorCompany";
                            ActionName = "AnchorDashboard";
                        }
                        if (RoleAccess == "Bank")
                        {
                            Controller = "BankCompany";
                            ActionName = "BankDashboard";
                        }
                        return(RedirectToAction(ActionName, Controller));
                    }
                    else
                    {
                        var data = Encoding.UTF8.GetBytes("InternalUser");
                        var Role = Convert.ToBase64String(data);
                        HttpContext.Session.SetString("Email", userModel.Email);
                        Controller = "Common";
                        ActionName = "ChangePassword";
                        SetCookie(UserID.ToString(), UserName, Role);
                        return(RedirectToAction(ActionName, Controller, new { RoleName = Role }));
                    }
                }
            }
            catch (Exception ex)
            {
                var st        = new StackTrace(ex, true);
                var frame     = st.GetFrame(0);
                int ErrorLine = frame.GetFileLineNumber();
                var Result    = _CommonRepository.LogManagement(ControllerName, ControllerActionName, ex.Message, ErrorLine, LoginUserID);
                return(RedirectToAction("ErrorPage", "Common"));
            }
        }