コード例 #1
0
        /// <summary>
        /// Resets the password of the given user and sends a message with the new password to their email address. Do not call if the system does not implement the
        /// forms authentication capable user management provider.
        /// </summary>
        public static void ResetAndSendPassword(int userId)
        {
            User user = SystemProvider.GetUser(userId);

            // reset the password
            var newPassword = new Password();

            SystemProvider.InsertOrUpdateUser(userId, user.Email, user.Role.RoleId, user.LastRequestDateTime, newPassword.Salt, newPassword.ComputeSaltedHash(), true);

            // send the email
            SendPassword(user.Email, newPassword.PasswordText);
        }