protected void Page_Load(object sender, EventArgs e) { string email = Server.UrlDecode(Request.QueryString[SiteEnums.QueryStringNames.email.ToString()]); string autoUnSub = Server.UrlDecode(Request.QueryString[SiteEnums.QueryStringNames.autounsubscribe.ToString()]); if (!string.IsNullOrWhiteSpace(email) && !string.IsNullOrWhiteSpace(autoUnSub)) { var ua = new UserAccount(); ua.GetUserAccountByEmail(email); var uad = new UserAccountDetail(); uad.GetUserAccountDeailForUser(ua.UserAccountID); uad.EmailMessages = false; uad.Update(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { var ua = new UserAccount(); ua.GetUserAccountByEmail(txtEmail.Text.Trim()); if (ua.UserAccountID == 0) { litResult.Text = @"<span style=""color:red"">Email not found!</span>"; return; } var uad = new UserAccountDetail(); uad.GetUserAccountDeailForUser(ua.UserAccountID); uad.EmailMessages = false; if (uad.Update()) { litResult.Text = @"<span style=""color:green"">Unsubscribed!</span>"; } else { litResult.Text = @"<span style=""color:red"">error!</span>"; } }
public ActionResult LogOn(LogOnModel model, string returnUrl) { if (ModelState.IsValid) { bool remember = Convert.ToBoolean(model.RememberMe); if (string.IsNullOrWhiteSpace(model.UserName) || string.IsNullOrWhiteSpace(model.Password)) { return View(model); } ua = new UserAccount(model.UserName); if (ua.UserAccountID == 0) { ua = new UserAccount(); ua.GetUserAccountByEmail(model.UserName); if (ua.UserAccountID > 0) { // they were stupid and put their email not username model.UserName = ua.UserName; } } if (Membership.ValidateUser(model.UserName, model.Password)) { FormsAuthentication.RedirectFromLoginPage(model.UserName, remember); if (!String.IsNullOrEmpty(returnUrl)) { return Redirect(returnUrl); } else { ua = new UserAccount(model.UserName); if (ua.IsLockedOut) { ModelState.AddModelError(string.Empty, BootBaronLib.Resources.Messages.IsLockedOut); return View(model); } ua.LastLoginDate = DateTime.UtcNow; ua.FailedPasswordAttemptCount = 0; ua.IsOnLine = true; ua.SigningOut = false; ua.Update(); UserAccountDetail uad = new UserAccountDetail(); uad.GetUserAccountDeailForUser(ua.UserAccountID); //uad.DefaultLanguage = Utilities.GetCurrentLanguageCode(); //uad.Update(); if (!string.IsNullOrWhiteSpace(uad.DefaultLanguage)) { HttpCookie hc = new HttpCookie(SiteEnums.CookieName.usersetting.ToString(), uad.DefaultLanguage); NameValueCollection nvc = new NameValueCollection(); nvc.Add(SiteEnums.CookieValue.language.ToString(), uad.DefaultLanguage); Utilities.CookieMaker(SiteEnums.CookieName.usersetting, nvc); Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(uad.DefaultLanguage); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(uad.DefaultLanguage); } return RedirectToAction("Home", "Account"); } } else { // it updates as online, make off ua = new UserAccount(model.UserName); if (ua.UserAccountID > 0) { ua.IsOnLine = false; ua.SigningOut = true; ua.Update(); } } } ModelState.AddModelError(string.Empty, BootBaronLib.Resources.Messages.LoginUnsuccessfulPleaseCorrect); // If we got this far, something failed, redisplay form return View(model); }
public ActionResult ForgotPassword(string email) { UserAccount ua = new UserAccount(); ua.GetUserAccountByEmail(email); if (ua.UserAccountID == 0) { ViewBag.Result = Messages.NotFound; } else { ua.FailedPasswordAnswerAttemptCount = 0; ua.FailedPasswordAttemptCount = 0; ua.IsLockedOut = false; ua.Update(); mu = Membership.GetUser(ua.UserName); string newPassword = mu.ResetPassword(); BootBaronLib.Operational.Utilities.SendMail(email, BootBaronLib.Configs.AmazonCloudConfigs.SendFromEmail, Messages.PasswordReset, Messages.UserName + ": " + ua.UserName + Environment.NewLine + Environment.NewLine + Messages.NewPassword + ": " + newPassword + Environment.NewLine + Environment.NewLine + Messages.SignIn + ": " + BootBaronLib.Configs.GeneralConfigs.SiteDomain); ViewBag.Result = Messages.CheckYourEmailAndSpamFolder; } return View(); }
public ActionResult FindByEmail(string email) { var ua = new UserAccount(); ua.GetUserAccountByEmail(email); if (ua.UserAccountID > 0) { SetUserAccountToEdit(ua); } LoadAllRoles(); return View("UserManagement"); }
public ActionResult ForgotPassword(string email) { var ua = new UserAccount(); ua.GetUserAccountByEmail(email); if (ua.UserAccountID == 0) { ViewBag.Result = Messages.NotFound; } else { ua.FailedPasswordAnswerAttemptCount = 0; ua.FailedPasswordAttemptCount = 0; ua.Update(); _mu = Membership.GetUser(ua.UserName); if (_mu != null) { string newPassword = _mu.ResetPassword(); _mail.SendMail(AmazonCloudConfigs.SendFromEmail, email, Messages.PasswordReset, string.Format("{0}: {1}{2}{2}{3}: {4}{2}{2}{5}: {6}", Messages.UserName, ua.UserName, Environment.NewLine, Messages.NewPassword, newPassword, Messages.SignIn, GeneralConfigs.SiteDomain)); } ViewBag.Result = Messages.CheckYourEmailAndSpamFolder; } return View(); }
public ActionResult FindByEmail(string email) { UserAccount ua = new UserAccount(); ua.GetUserAccountByEmail(email); if (ua.UserAccountID > 0) { ViewBag.SelectedUser = ua; UserAccountDetail uad = new UserAccountDetail(); uad.GetUserAccountDeailForUser(ua.UserAccountID); ViewBag.UserAccountDetail = uad; } LoadAllRoles(); return View("UserManagement"); }