Ejemplo n.º 1
0
        public override MembershipUser CreateUser(string username, string password, string email,
                                                  string passwordQuestion, string passwordAnswer,
                                                  bool isApproved, object providerUserKey,
                                                  out MembershipCreateStatus status)
        {
            var user = new MongoDBMembershipUser()
            {
                ProviderName     = this.Name, Username = username, Password = password, Email = email,
                PasswordQuestion = passwordQuestion, PasswordAnswer = passwordAnswer,
                IsApproved       = isApproved, IsLockedOut = false, ProviderUserKey = providerUserKey,
                LastActivityDate = DateTime.UtcNow,
            };

            try{
                members.Insert(user, true);
            }catch (MongoDuplicateKeyException) {
                status = MembershipCreateStatus.DuplicateUserName;
            }catch (MongoException) {
                status = MembershipCreateStatus.ProviderError;
            }
            status = MembershipCreateStatus.Success;
            return((MembershipUser)user);
        }
Ejemplo n.º 2
0
 public override MembershipUser CreateUser(string username, string password, string email, 
     string passwordQuestion, string passwordAnswer,
     bool isApproved, object providerUserKey,
     out MembershipCreateStatus status)
 {
     var user = new MongoDBMembershipUser(){ProviderName=this.Name, Username=username, Password=password,Email=email,
                                         PasswordQuestion = passwordQuestion, PasswordAnswer = passwordAnswer,
                                         IsApproved = isApproved, IsLockedOut = false, ProviderUserKey=providerUserKey,
                                         LastActivityDate = DateTime.UtcNow,};
     try{
         members.Insert(user, true);
     }catch(MongoDuplicateKeyException){
         status = MembershipCreateStatus.DuplicateUserName;
     }catch(MongoException){
         status = MembershipCreateStatus.ProviderError;
     }
     status = MembershipCreateStatus.Success;
     return (MembershipUser)user;
 }