public void RegisterUser(User user) { _context.User.Update(user); }
/// <summary> /// Create a User in MogoDB /// </summary> /// <param name="username"></param> /// <param name="password"></param> /// <param name="email"></param> /// <param name="passwordQuestion"></param> /// <param name="passwordAnswer"></param> /// <param name="isApproved"></param> /// <param name="providerUserKey"></param> /// <param name="status"></param> /// <returns></returns> public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { ValidatePasswordEventArgs args = new ValidatePasswordEventArgs(username, password, true); OnValidatingPassword(args); if (args.Cancel) { status = MembershipCreateStatus.InvalidPassword; return null; } if (RequiresUniqueEmail && GetUserNameByEmail(email) != string.Empty) { status = MembershipCreateStatus.DuplicateEmail; return null; } MembershipUser user = GetUser(username, true); if (user == null) { User userObj = new User(); userObj.UserId = ObjectId.GenerateNewId(); userObj.Name = username; userObj.NameNormalize = username.ToUrl(); userObj.Password = GetMD5Hash(password); userObj.Email = email.ToLower(); _userService.RegisterUser(userObj); status = MembershipCreateStatus.Success; return GetUser(username, true); } else { status = MembershipCreateStatus.DuplicateUserName; } return null; }