Ejemplo n.º 1
0
        /// <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();
            }
        }
Ejemplo n.º 2
0
        // Instructions to allow passwords to be changed in Edit User dialog.
        // 1. Remove the InsertUpdate method which generates a random password
        // 2. Uncomment the first part of UpdProcs.updUser

        /// <summary>
        /// Inserts or updates a user
        /// </summary>
        /// <param name="command">A SQL Command instance</param>
        protected override void InsertUpdate(SqlCommand command)
        {
            Boolean sendEmail    = false;
            String  tempPassword = Singular.Misc.Password.CreateRandomEasyPassword(8);

            if (this.IsNew)
            {
                sendEmail     = true;
                this.Password = tempPassword;
            }

            base.InsertUpdate(command);

            if (sendEmail)
            {
                EMailBuilder.Create(this.EmailAddress, "OfficeExpressTuckShop User Created")
                .AddHeading("OfficeExpressTuckShop User Created")
                .AddParagraph("Please note, your user for OfficeExpressTuckShop has been created.")
                .AddParagraph("User Name: " + this.LoginName + "<br/>Password: "******"Please log in as soon as possible with the above temporary password. You will be required to change your password the first time you log in.")
                .AddRegards()
                .Save();
            }
        }