コード例 #1
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
            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."));
            }
        }
コード例 #2
0
ファイル: Command.cs プロジェクト: MerlinCooper/f1livetiming
 public Command3(CommandProc <T1, T2, T3> proc, T1 arg1, T2 arg2, T3 arg3)
 {
     _proc = proc;
     _arg1 = arg1;
     _arg2 = arg2;
     _arg3 = arg3;
 }
コード例 #3
0
ファイル: Command.cs プロジェクト: MerlinCooper/f1livetiming
 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;
 }
コード例 #4
0
 /// <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;
 }
コード例 #5
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;
            }
        }
コード例 #6
0
ファイル: Command.cs プロジェクト: MerlinCooper/f1livetiming
 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;
 }
コード例 #7
0
ファイル: Command.cs プロジェクト: MerlinCooper/f1livetiming
 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;
 }
コード例 #8
0
ファイル: Command.cs プロジェクト: MerlinCooper/f1livetiming
 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;
 }
コード例 #9
0
        /// <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);
        }
コード例 #10
0
ファイル: User.cs プロジェクト: Jackelope96/OfficeExpress
        /// <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("");
                }
            };
        }
コード例 #11
0
ファイル: User.cs プロジェクト: Jackelope96/OfficeExpress
        /// <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();
            }
        }
コード例 #12
0
ファイル: Command.cs プロジェクト: MerlinCooper/f1livetiming
 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));
 }
コード例 #13
0
ファイル: Command.cs プロジェクト: MerlinCooper/f1livetiming
 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));
 }
コード例 #14
0
ファイル: Command.cs プロジェクト: MerlinCooper/f1livetiming
 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));
 }
コード例 #15
0
ファイル: Command.cs プロジェクト: MerlinCooper/f1livetiming
 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));
 }
コード例 #16
0
ファイル: Command.cs プロジェクト: MerlinCooper/f1livetiming
 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));
 }
コード例 #17
0
ファイル: Command.cs プロジェクト: MerlinCooper/f1livetiming
 public static ICommand MakeCommand <T1, T2>(CommandProc <T1, T2> proc, T1 arg1, T2 arg2)
 {
     return(new Command2 <T1, T2>(proc, arg1, arg2));
 }
コード例 #18
0
ファイル: Command.cs プロジェクト: MerlinCooper/f1livetiming
 public static ICommand MakeCommand <T1>(CommandProc <T1> proc, T1 arg1)
 {
     return(new Command1 <T1>(proc, arg1));
 }
コード例 #19
0
ファイル: Command.cs プロジェクト: MerlinCooper/f1livetiming
 public static ICommand MakeCommand(CommandProc proc)
 {
     return(new Command0(proc));
 }
コード例 #20
0
 public Command(string pattern, string method, CommandProc proc)
 {
     this.PathPattern = pattern;
     this.HttpMethod = method;
     this.Procedure = proc;
 }
コード例 #21
0
 /// <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));
 }
コード例 #22
0
ファイル: Command.cs プロジェクト: MerlinCooper/f1livetiming
 public Command0(CommandProc proc)
 {
     _proc = proc;
 }
コード例 #23
0
 protected override void SetupCommandProc(CommandProc cmd)
 {
     cmd.CommandText = "RptProcs.rptManagementSphereSummary";
 }
コード例 #24
0
ファイル: Command.cs プロジェクト: MerlinCooper/f1livetiming
 public Command2(CommandProc <T1, T2> proc, T1 arg1, T2 arg2)
 {
     _proc = proc;
     _arg1 = arg1;
     _arg2 = arg2;
 }
コード例 #25
0
ファイル: Command.cs プロジェクト: MerlinCooper/f1livetiming
 public Command1(CommandProc <T1> proc, T1 arg1)
 {
     _proc = proc;
     _arg1 = arg1;
 }
コード例 #26
0
        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));
        }
コード例 #27
0
 static extern int KiWi_Initlize(int ApplicationType, CommandProc fp);