Esempio n. 1
0
        public static string CreateAccount(string userName, string password, string email, string mobileNumber, string routingNumber, string accountNumber,
                                           int accountType, out MembershipCreateStatus createStatus, bool requireConfirmationToken = false)
        {
            CodeFirstExtendedProvider provider = VerifyProvider();

            return(provider.CreateAccount(userName, password, email, mobileNumber, routingNumber, accountNumber, accountType, out createStatus, requireConfirmationToken));
        }
Esempio n. 2
0
        private static CodeFirstExtendedProvider VerifyProvider()
        {
            CodeFirstExtendedProvider provider = Membership.Provider as CodeFirstExtendedProvider;

            if (provider == null)
            {
                throw new InvalidOperationException("Provider Is Not ExtendedMembershipProvider");
            }
            return(provider);
        }
Esempio n. 3
0
        public static bool Login(string userNameOrEmail, string password, bool persistCookie = false)
        {
            CodeFirstExtendedProvider provider = VerifyProvider();
            dynamic success = provider.ExtendedValidateUser(userNameOrEmail, password);

            if (!(string.IsNullOrEmpty(success)))
            {
                FormsAuthentication.SetAuthCookie(success, persistCookie);
                return(true);
            }
            else
            {
                return(false);
            }
        }
 private static bool IsAccountLockedOutInternal(CodeFirstExtendedProvider provider, string userName, int allowedPasswordAttempts, TimeSpan interval)
 {
     return (provider.GetUser(userName, false) != null && provider.GetPasswordFailuresSinceLastSuccess(userName) > allowedPasswordAttempts && provider.GetLastPasswordFailureDate(userName).Add(interval) > DateTime.UtcNow);
 }
Esempio n. 5
0
        public static bool ConfirmAccount(string accountConfirmationToken)
        {
            CodeFirstExtendedProvider provider = VerifyProvider();

            return(provider.ConfirmAccount(accountConfirmationToken));
        }
Esempio n. 6
0
        public static DateTime GetLastPasswordFailureDate(string userName)
        {
            CodeFirstExtendedProvider provider = VerifyProvider();

            return(provider.GetLastPasswordFailureDate(userName));
        }
Esempio n. 7
0
        public static DateTime GetCreateDate(string userName)
        {
            CodeFirstExtendedProvider provider = VerifyProvider();

            return(provider.GetCreateDate(userName));
        }
Esempio n. 8
0
        public static int GetPasswordFailuresSinceLastSuccess(string userName)
        {
            CodeFirstExtendedProvider provider = VerifyProvider();

            return(provider.GetPasswordFailuresSinceLastSuccess(userName));
        }
Esempio n. 9
0
 private static bool IsAccountLockedOutInternal(CodeFirstExtendedProvider provider, string userName, int allowedPasswordAttempts, TimeSpan interval)
 {
     return(provider.GetUser(userName, false) != null && provider.GetPasswordFailuresSinceLastSuccess(userName) > allowedPasswordAttempts && provider.GetLastPasswordFailureDate(userName).Add(interval) > DateTime.UtcNow);
 }
Esempio n. 10
0
        public static bool IsAccountLockedOut(string userName, int allowedPasswordAttempts, TimeSpan interval)
        {
            CodeFirstExtendedProvider provider = VerifyProvider();

            return(IsAccountLockedOutInternal(provider, userName, allowedPasswordAttempts, interval));
        }
Esempio n. 11
0
        public static bool ResetPassword(string passwordResetToken, string newPassword)
        {
            CodeFirstExtendedProvider provider = VerifyProvider();

            return(provider.ResetPasswordWithToken(passwordResetToken, newPassword));
        }
Esempio n. 12
0
        public static bool IsConfirmed(string userName)
        {
            CodeFirstExtendedProvider provider = VerifyProvider();

            return(provider.IsConfirmed(userName));
        }
Esempio n. 13
0
        public static Guid GetUserIdFromPasswordResetToken(string token)
        {
            CodeFirstExtendedProvider provider = VerifyProvider();

            return(provider.GetUserIdFromPasswordResetToken(token));
        }
Esempio n. 14
0
        public static string GeneratePasswordResetToken(string userName, int tokenExpirationInMinutesFromNow = 1440)
        {
            CodeFirstExtendedProvider provider = VerifyProvider();

            return(provider.GeneratePasswordResetToken(userName, tokenExpirationInMinutesFromNow));
        }