Example #1
0
        /// <summary>
        /// Returns the date and time when an incorrect password was most recently entered for the specified account.
        /// </summary>
        /// <param name="userName">The user name of the membership account.</param>
        /// <returns>The date and time when an incorrect password was most recently entered for this account, or <see cref="System.DateTime.MinValue"/> if an incorrect password has not been entered for this account.</returns>
        /// <exception cref="System.InvalidOperationException">
        /// The <seealso cref="Initialized"/> method was not called.-or-
        /// The <seealso cref="InitializeDatabaseConnection(string)"/> method was not called.-or-
        /// The <seealso cref="MySqlSimpleMembershipProvider"/> membership provider is not registered in the configuration of your site.
        /// For more information, contact your site's system administrator.
        /// </exception>
        public static DateTime GetLastPasswordFailureDate(string userName)
        {
            MySqlSimpleMembershipProvider provider = VerifyProvider();

            Debug.Assert(provider != null); // VerifyProvider checks this

            return(provider.GetLastPasswordFailureDate(userName));
        }
Example #2
0
 internal static bool IsAccountLockedOutInternal(MySqlSimpleMembershipProvider provider, string userName, int allowedPasswordAttempts, TimeSpan interval)
 {
     return(provider.GetUser(userName, false) != null &&
            provider.GetPasswordFailuresSinceLastSuccess(userName) > allowedPasswordAttempts &&
            provider.GetLastPasswordFailureDate(userName).Add(interval) > DateTime.Now);
 }