private void UpdateSharedLoggedInUserInfo(ValidateUserLogin validateUserLogin) { Na.Core.SharedInfo _sharedInfo = new Na.Core.SharedInfo(); LoggedInUserInfo objLoggedInUserInfo = new LoggedInUserInfo(); objLoggedInUserInfo.FBUser = validateUserLogin.FBUser; objLoggedInUserInfo.LoginUserMiscInfo = validateUserLogin.LoginUserMiscInfo; objLoggedInUserInfo.User = validateUserLogin.User; objLoggedInUserInfo.UserAccount = validateUserLogin.UserAccount; _sharedInfo.LoggedInUserInfo = objLoggedInUserInfo; }
public ActionResult Login(LoginModel model, string ReturnUrl) { Na.Core.SharedInfo _sharedInfo = new Na.Core.SharedInfo(); ModelState.Remove("EmailAddess");// Added By Rakesh: purpose: on login button click validatin for forgot password email also arises : done on 02 August 2013. if (ValidateLogOn(model)) { // if (!String.IsNullOrWhiteSpace(ReturnUrl) && !ReturnUrl.ToLower().Contains("http://" + Request.Url.Host.ToLower())) { ReturnUrl = Na.Core.Configuration.NaConfig.Url.DomainUrl + "/" + ReturnUrl.Replace("//", "/"); } // Done by Rachna/S on 27 jan 14 w.r.t to #348 if (!String.IsNullOrWhiteSpace(ReturnUrl) && !ReturnUrl.ToLower().Contains("http://" + Request.Url.Host.ToLower())) { if (ReturnUrl.StartsWith("/")) { ReturnUrl = Na.Core.Configuration.NaConfig.Url.DomainUrl + ReturnUrl; } else { ReturnUrl = Na.Core.Configuration.NaConfig.Url.DomainUrl + "/" + ReturnUrl; } } string returnUrl = (ReturnUrl != null) ? ReturnUrl : model.ReturnUrl; var user = new User(); var userAccount = new UserAccountInformation(); int status = (int)LoginOrReset.Login;// Added By Rakesh kumar get the value from Enum bool lblogin = fcnLogin(model, ref user, ref userAccount, status); if (lblogin) { //sign in new user user = _sharedInfo.ConvertUserModelToUser(_sharedInfo.LoggedInUserInfo.User); _authenticationService.SignIn(user, model.RememberMe); #region Redirect After Login by Chandi@20130124 string PageLists = _common.GetStringValue(_config.GetStringValueFromConfig("RedirectControllAfterLogin", string.Empty), string.Empty); if (isRedirectControllPageAfterLogin(PageLists, returnUrl.Replace(Na.Core.Configuration.NaConfig.Url.DomainUrl + "/", ""))) { var _url = fcnRedirectedPage(); if (!String.IsNullOrWhiteSpace(_url)) { returnUrl = Na.Core.Configuration.NaConfig.Url.DomainUrl + "/" + _url; } else { returnUrl = Na.Core.Configuration.NaConfig.Url.DomainUrl + "/browse"; } } #endregion if (!String.IsNullOrEmpty(returnUrl) && !returnUrl.ToLower().Contains("login")) return Redirect(returnUrl); else return Redirect(Na.Core.Configuration.NaConfig.Url.DomainUrl + "/myaccount"); } else { if (!model.isConcurrent) { model.loginMessage = string.Empty; model.loginMessage = "<div class=\"alert-panel\"><div class=\"alert alert-success\"><button data-dismiss=\"alert\" class=\"close\" type=\"button\">×</button>" + "The username and/or password you have provided cannot be found in our records.</div></div>"; } } } return View(model); }