public ActionResult ChangePassword(string id) { int userId = 0; if (!string.IsNullOrEmpty(id)) { var mailKey = clsUtils.getmainkey(); userId = int.Parse(Encription.AESEncryption.DecryptData(id, mailKey)); ViewBag.HideMenu = true; } OneFineRateBLL.BL_Login.UserDetails userDetail = null; userDetail = Session["UserDetails"] as OneFineRateBLL.BL_Login.UserDetails; if (userDetail == null) { userDetail = new BL_Login.UserDetails(); userDetail.iUserId = userId; } ViewBag.UserName = (string.IsNullOrEmpty(userDetail.FisrtName) ? "" : userDetail.FisrtName) + " " + (string.IsNullOrEmpty(userDetail.LastName) ? "" : userDetail.LastName);//Session["USER_NAME"]; if (string.IsNullOrEmpty(Session["MenuType"] as string)) { Session["MenuType"] = 1; } //TempData["uid"] = OneFineRateBLL.BL_Login.getDecryptedUserId(userDetails.UserName); return(View(userDetail)); }
public ActionResult Login(OneFineRateBLL.Entities.eLogin model, string returnUrl) { TempData["Error"] = null; if (ModelState.IsValid) { OneFineRateBLL.BL_Login.UserDetails eobj = new OneFineRateBLL.BL_Login.UserDetails(); OneFineRateBLL.BL_Login.UserDetails eobjActiveUser = new OneFineRateBLL.BL_Login.UserDetails(); OneFineRateAppUtil.clsUtils.ConvertToObject(OneFineRateBLL.BL_Login.ValidateUser(model.UserName, model.Password), eobj); OneFineRateAppUtil.clsUtils.ConvertToObject(OneFineRateBLL.BL_Login.ActiveUser(model.UserName), eobjActiveUser); if (eobj.iUserId > 0 && eobjActiveUser.cStatus == "A") { if (model.RememberMe) { Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(30); Response.Cookies["Password"].Expires = DateTime.Now.AddDays(30); } else { Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(-1); Response.Cookies["Password"].Expires = DateTime.Now.AddDays(-1); } Response.Cookies["UserName"].Value = model.UserName.Trim(); Response.Cookies["Password"].Value = model.Password.Trim(); Session["UserDetails"] = eobj; Session["MenuType"] = "1"; //Session["Username"] = eobj.UserName; //Session["FisrtName"] = eobj.FisrtName; //Session["LastName"] = eobj.LastName; string sPath = OneFineRateBLL.BL_Menu.GetHomePageByUserId(eobj.iUserId); if (sPath != null) { FormsAuthentication.SetAuthCookie(model.UserName, true); #region Redirect For Booking Confirmation if (model.sBookingId != null) { var bookingIdDecoded = OneFineRateAppUtil.clsUtils.Decode(model.sBookingId); var iPropId = BL_Booking.GetPropIdByBookingId(bookingIdDecoded); if (iPropId.HasValue) { Session["MenuType"] = "2"; Session["PropId"] = iPropId; Session["CurrCode"] = BL_Currency.GetCurrencyByPropId(iPropId.Value); //Session["Symbol"] = BL_Currency.GetSymbolByPropId(PropId); Session["Flag"] = BL_Currency.GetFlagByPropId(iPropId.Value); Session["PropName"] = BL_PropDetails.GetPropertyName(iPropId.Value); return(RedirectToRoute("BookingConfirmation", new { bookingId = model.sBookingId })); } } #endregion Redirect For Pending Confirmation #region Redirect For Pending Negotiation if (model.sPropId != null) { int iPropId = 0; try { iPropId = int.Parse(clsUtils.Decode(model.sPropId)); } catch (Exception) { } if (iPropId > 0) { Session["MenuType"] = "2"; Session["PropId"] = iPropId; Session["CurrCode"] = BL_Currency.GetCurrencyByPropId(iPropId); //Session["Symbol"] = BL_Currency.GetSymbolByPropId(PropId); Session["Flag"] = BL_Currency.GetFlagByPropId(iPropId); Session["PropName"] = BL_PropDetails.GetPropertyName(iPropId); return(RedirectToAction("Index", "PendingNegotiations")); } } #endregion string[] Values = sPath.Split('/'); if (Values.Length == 2) { //FormsAuthentication.RedirectFromLoginPage(model.UserName, model.RememberMe); return(RedirectToAction("Index", Values[1])); } else { //FormsAuthentication.RedirectFromLoginPage(model.UserName, model.RememberMe); return(RedirectToAction(Values[2], Values[1])); } } else { TempData["Error"] = "All the Groups are Inactive for this user."; } } if (eobj.iUserId == 0) { // ModelState.AddModelError("", "Incorrect username and/or password"); TempData["Error"] = "Incorrect username and/or password"; } else if (eobjActiveUser.cStatus == "I") { TempData["Error"] = "User has been diasbled by Administrator."; } } return(View(model)); }