public static Tuple <Singular.Web.MessageType, String> ChangePassword(ChangeDetails details) { // Check for any business rule failures if (!details.CheckAllRules()) { return(Tuple.Create(Singular.Web.MessageType.Validation, "Validation failed")); } // Check if the password meets complexity requirements Singular.Misc.Password.PasswordChecker passwordChecker = new Singular.Misc.Password.PasswordChecker(8, true, true, true, false, 1); if (!passwordChecker.CheckPassword(details.NewPassword)) { return(Tuple.Create(Singular.Web.MessageType.Warning, passwordChecker.ErrorMessage)); } // Attempt to change the user's password DataRow result = CommandProc.GetDataRow( "CmdProcs.cmdChangePassword", new string[] { "@UserID", "@OldPassword", "@NewPassword" }, new object[] { Singular.Settings.CurrentUserID, OETWebSecurity.GetPasswordHash(details.OldPassword), OETWebSecurity.GetPasswordHash(details.NewPassword) }); if (!(bool)result[0]) { return(Tuple.Create(Singular.Web.MessageType.Warning, "The password you entered doesn't match your current password.")); } else { return(Tuple.Create(Singular.Web.MessageType.Success, "Change Password Success.")); } }
public ActionResult DeleteConfirmed(int id) { ChangeDetails changeDetails = db.ChangeDetails.Find(id); db.ChangeDetails.Remove(changeDetails); db.SaveChanges(); return(RedirectToAction("Index")); }
private void ChangeDetail(object obj) { ChangeDetails cd = new ChangeDetails(); ChangeDetailsViewModel cdvm = new ChangeDetailsViewModel(Id); cd.DataContext = cdvm; cd.Show(); }
public void TestChangeDetails(string input, ChangeDetails changeDetails) { var target = new LocationParser(); var result = target.Parse(input, out var message); Assert.IsNull(message); Assert.AreEqual(changeDetails, result.ChangeDetails[0]); }
public static Tuple <Singular.Web.MessageType, String> ChangePassword(ChangeDetails details) { // Check for any business rule failures if (!details.CheckAllRules()) { return(Tuple.Create(Singular.Web.MessageType.Validation, "Validation failed")); } // Check if the password meets complexity requirements Singular.Misc.Password.PasswordChecker passwordChecker = new Singular.Misc.Password.PasswordChecker(8, true, true, true, false, 1); if (!passwordChecker.CheckPassword(details.NewPassword)) { return(Tuple.Create(Singular.Web.MessageType.Warning, passwordChecker.ErrorMessage)); } // Attempt to change the user's password int CheckOP = 0; if (details.OldPassword != "") { CheckOP = 1; } try { DataRow result = CommandProc.GetDataRow( "CmdProcs.cmdChangePassword", new string[] { "@UserID", "@OldPassword", "@NewPassword", "@CheckOldPassword" }, new object[] { Singular.Settings.CurrentUserID, MEWebSecurity.CurrentIdentity().FirstTimeLogin == false || MEWebSecurity.CurrentIdentity().ResetState == ResetState.MustResetPassword? MEWebSecurity.GetPasswordHash(details.OldPassword) : details.OldPassword, MEWebSecurity.GetPasswordHash(details.NewPassword), CheckOP }); if (bool.Parse(result.ItemArray[0].ToString()) == true) { if (MELib.Security.MEWebSecurity.CurrentIdentity().Roles.Contains("Users.ForgotPassword")) { MELib.Security.MEWebSecurity.CurrentIdentity().Roles.Remove("Users.ForgotPassword"); } MEWebSecurity.CurrentIdentity().MarkNonFirstTimeLogin(); MEWebSecurity.CurrentIdentity().ChangedPassword(); return(Tuple.Create(Singular.Web.MessageType.Success, "Change Password Success.")); } else { return(Tuple.Create(Singular.Web.MessageType.Error, "Change Password Failed - Incorrect Temporary Password")); } } catch (Exception) { return(Tuple.Create(Singular.Web.MessageType.Error, "Change Password Failed - Please contact System Administrator")); throw; } }
/// <summary> /// Setup the ChangePasswordVM View Model /// </summary> protected override void Setup() { base.Setup(); this.Details = new ChangeDetails(); if (Page.Request.QueryString["WasReset"] != null) { AddMessage(Singular.Web.MessageType.Information, "Reset Password", "You have logged in with a temporary password. Please choose a new password now."); } }
public ActionResult Edit([Bind(Include = "Id,ChangesId,Description")] ChangeDetails changeDetails) { if (ModelState.IsValid) { db.Entry(changeDetails).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ChangesId = new SelectList(db.Changes, "Id", "Ip", changeDetails.ChangesId); return(View(changeDetails)); }
public ActionResult Create([Bind(Include = "Id,ChangesId,Description")] ChangeDetails changeDetails) { if (ModelState.IsValid) { db.ChangeDetails.Add(changeDetails); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ChangesId = new SelectList(db.Changes, "Id", "Ip", changeDetails.ChangesId); return(View(changeDetails)); }
public override int GetHashCode() { unchecked { int hashCode = (ChangeDetails != null ? ChangeDetails.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (IssueDetails != null ? IssueDetails.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Generated.GetHashCode(); hashCode = (hashCode * 397) ^ (FromVersion != null ? FromVersion.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ToVersion != null ? ToVersion.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ReferenceBuildConfiguration != null ? ReferenceBuildConfiguration.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (BuildConfiguration != null ? BuildConfiguration.GetHashCode() : 0); return(hashCode); } }
// GET: ChangeDetails/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ChangeDetails changeDetails = db.ChangeDetails.Find(id); if (changeDetails == null) { return(HttpNotFound()); } return(View(changeDetails)); }
// GET: ChangeDetails/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ChangeDetails changeDetails = db.ChangeDetails.Find(id); if (changeDetails == null) { return(HttpNotFound()); } ViewBag.ChangesId = new SelectList(db.Changes, "Id", "Ip", changeDetails.ChangesId); return(View(changeDetails)); }