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 Command3(CommandProc <T1, T2, T3> proc, T1 arg1, T2 arg2, T3 arg3) { _proc = proc; _arg1 = arg1; _arg2 = arg2; _arg3 = arg3; }
public Command4(CommandProc <T1, T2, T3, T4> proc, T1 arg1, T2 arg2, T3 arg3, T4 arg4) { _proc = proc; _arg1 = arg1; _arg2 = arg2; _arg3 = arg3; _arg4 = arg4; }
/// <summary> /// Initializes a new instance of the <see cref="CommandItem" /> class. /// </summary> /// <param name="id">The unique command id.</param> /// <param name="sortIndex">The sort index, defining the sequence of the items to appear.</param> /// <param name="text">The text.</param> /// <param name="description">The description.</param> /// <param name="doProc">The do proc.</param> public CommandItem(string id, int sortIndex, ITranslatableString text, ITranslatableString description, CommandProc doProc) { this.Id = id; this.sortIndex = sortIndex; this.text = text; this.description = description; this.doProc = doProc; }
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; } }
public Command5(CommandProc <T1, T2, T3, T4, T5> proc, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) { _proc = proc; _arg1 = arg1; _arg2 = arg2; _arg3 = arg3; _arg4 = arg4; _arg5 = arg5; }
public Command6(CommandProc <T1, T2, T3, T4, T5, T6> proc, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) { _proc = proc; _arg1 = arg1; _arg2 = arg2; _arg3 = arg3; _arg4 = arg4; _arg5 = arg5; _arg6 = arg6; }
public Command7(CommandProc <T1, T2, T3, T4, T5, T6, T7> proc, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) { _proc = proc; _arg1 = arg1; _arg2 = arg2; _arg3 = arg3; _arg4 = arg4; _arg5 = arg5; _arg6 = arg6; _arg7 = arg7; }
/// <summary> /// Marks the user as not first time login. This should be called after the user has gone to any page / or whatever process needs to run for first time users. /// </summary> public void MarkNonFirstTimeLogin() { this.firstTimeLogin = false; // Call a cmd proc to update this in the database. CommandProc commandProc = new CommandProc("CmdProcs.cmdMarkNonFirstTimeLogin", new string[] { "@UserID" }, new object[] { this.UserID }); commandProc.CommandType = System.Data.CommandType.StoredProcedure; commandProc = commandProc.Execute(); //CommandProc mycommandProc = new CommandProc("[CmdProcs].[cmdSectionAccess]", ParameterArray, ValuesArray); //mycommandProc.Parameters.Add(new CommandProc.Parameter() { Name = "@HasAccess", Direction = System.Data.ParameterDirection.Output, SqlType = System.Data.SqlDbType.Bit }); //mycommandProc.CommandType = System.Data.CommandType.StoredProcedure; //mycommandProc.FetchType = Singular.CommandProc.FetchTypes.DataRow; //mycommandProc = mycommandProc.Execute(); //bPassCheck = Convert.ToBoolean(mycommandProc.Parameters[0].Value); }
/// <summary> /// Adds rules to enforce Email Address entry and detect if a Username already exists /// </summary> protected override void AddCustomPasswordRule() { // Add custom password rule this.AddWebRule(EmailAddressProperty, u => u.EmailAddress == "", u => "Email address is required"); JavascriptRule <User> rule = AddWebRule(User.LoginNameProperty, u => u.LoginName == "", u => ""); rule.ASyncBusyText = "Checking rule..."; rule.ServerRuleFunction = (user) => { CommandProc commandProc = new CommandProc("CmdProcs.cmdCheckUserExists", new string[] { "@UserID", "@UserName" }, new object[] { user.UserID, user.LoginName }, CommandProc.FetchTypes.DataRow); if (commandProc.Execute().DataRowValue != null) { return("A user with this name already exists."); } else { return(""); } }; }
/// <summary> /// Reset a user's password /// </summary> /// <param name="userName">The user's username</param> public static void ResetPassword(string userName) { //string newPassword = Singular.Misc.Password.CreateRandomEasyPassword(8); string newPassword = "******"; CommandProc commandProc = new CommandProc( "CmdProcs.cmdResetPassword", new string[] { "@UserName", "@RandomPassword" }, new object[] { userName, OETLib.Security.OETWebSecurity.GetPasswordHash(newPassword) }, Singular.CommandProc.FetchTypes.DataRow); commandProc = commandProc.Execute(); if ((bool)commandProc.DataRow[0]) { EMailBuilder.Create(commandProc.DataRow["EmailAddress"].ToString(), "Password Reset") .AddHeading("Password Reset") .AddParagraph("Please note, your password for OfficeExpressTuckShop has been reset to " + newPassword) .AddParagraph("Please log in as soon as possible, and change your password.") .AddRegards() .Save(); } }
public static ICommand MakeCommand <T1, T2, T3, T4, T5, T6, T7>(CommandProc <T1, T2, T3, T4, T5, T6, T7> proc, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) { return(new Command7 <T1, T2, T3, T4, T5, T6, T7>(proc, arg1, arg2, arg3, arg4, arg5, arg6, arg7)); }
public static ICommand MakeCommand <T1, T2, T3, T4, T5, T6>(CommandProc <T1, T2, T3, T4, T5, T6> proc, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) { return(new Command6 <T1, T2, T3, T4, T5, T6>(proc, arg1, arg2, arg3, arg4, arg5, arg6)); }
public static ICommand MakeCommand <T1, T2, T3, T4, T5>(CommandProc <T1, T2, T3, T4, T5> proc, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) { return(new Command5 <T1, T2, T3, T4, T5>(proc, arg1, arg2, arg3, arg4, arg5)); }
public static ICommand MakeCommand <T1, T2, T3, T4>(CommandProc <T1, T2, T3, T4> proc, T1 arg1, T2 arg2, T3 arg3, T4 arg4) { return(new Command4 <T1, T2, T3, T4>(proc, arg1, arg2, arg3, arg4)); }
public static ICommand MakeCommand <T1, T2, T3>(CommandProc <T1, T2, T3> proc, T1 arg1, T2 arg2, T3 arg3) { return(new Command3 <T1, T2, T3>(proc, arg1, arg2, arg3)); }
public static ICommand MakeCommand <T1, T2>(CommandProc <T1, T2> proc, T1 arg1, T2 arg2) { return(new Command2 <T1, T2>(proc, arg1, arg2)); }
public static ICommand MakeCommand <T1>(CommandProc <T1> proc, T1 arg1) { return(new Command1 <T1>(proc, arg1)); }
public static ICommand MakeCommand(CommandProc proc) { return(new Command0(proc)); }
public Command(string pattern, string method, CommandProc proc) { this.PathPattern = pattern; this.HttpMethod = method; this.Procedure = proc; }
/// <summary> /// Adds the command. /// </summary> /// <param name="id">The unique command id.</param> /// <param name="commandSortIndex">The sort index, defining the sequence of the items to appear.</param> /// <param name="commandText">The commandText.</param> /// <param name="commandDescription">The commandDescription.</param> /// <param name="commandDoProc">The command procedure to be called to execute the command.</param> /// <returns>The new command item.</returns> public ICommandItem AddCommand(string id, int commandSortIndex, ITranslatableString commandText, ITranslatableString commandDescription, CommandProc commandDoProc) { return(this.commandProvider.AddCommand(id, commandSortIndex, commandText, commandDescription, commandDoProc)); }
public Command0(CommandProc proc) { _proc = proc; }
protected override void SetupCommandProc(CommandProc cmd) { cmd.CommandText = "RptProcs.rptManagementSphereSummary"; }
public Command2(CommandProc <T1, T2> proc, T1 arg1, T2 arg2) { _proc = proc; _arg1 = arg1; _arg2 = arg2; }
public Command1(CommandProc <T1> proc, T1 arg1) { _proc = proc; _arg1 = arg1; }
public ICommandItem AddCommand(string id, int commandSortIndex, ITranslatableString commandText, ITranslatableString commandDescription, CommandProc commandDoProc) { var newItem = new CommandItem(id, commandSortIndex, commandText, commandDescription, commandDoProc); return(this.AddCommand(newItem)); }
static extern int KiWi_Initlize(int ApplicationType, CommandProc fp);