public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { if (string.IsNullOrEmpty(username)) { status = MembershipCreateStatus.InvalidUserName; return null; } if (string.IsNullOrEmpty(email)) { status = MembershipCreateStatus.InvalidEmail; return null; } if (!string.IsNullOrEmpty(password) && password.Length < MinRequiredPasswordLength) { status = MembershipCreateStatus.InvalidPassword; return null; } var repository = new SecurityRepository(); if (repository.TestUserByLogin(username)) { status = MembershipCreateStatus.DuplicateUserName; return null; } if (repository.TestUserByEmail(email)) { status = MembershipCreateStatus.DuplicateEmail; return null; } var salt = SaltGenerator.GenerateSalt(); var account = new User { Login = username, EMail = email, Salt = salt, FirstName = username, LastName = username, PasswordQuestion = passwordQuestion, PasswordAnswer = passwordAnswer }; repository.SaveUser(account); var user = (AccountMembershipUser)GetUser(username, false); if (user != null) { user.SavePassword(password); status = MembershipCreateStatus.Success; } else status = MembershipCreateStatus.ProviderError; return user; }