/// <summary> /// Registers a new user. /// </summary> /// <param name="displayName">The display name.</param> /// <param name="email">The email address.</param> /// <param name="password">The clear-text password.</param> /// <returns>The identifier of the newly created user.</returns> public Guid RegisterUser(string displayName, string email, string password) { Validate.NotNullOrWhitespace(displayName, nameof(displayName)); Validate.NotNullOrWhitespace(email, nameof(email)); Validate.NotNullOrWhitespace(password, nameof(password)); Validate.PasswordStrenth(password, 1, 1, 1, 1); // Hash the clear text password. string hashedPassword = _passwordHashingProvider.ComputeHash(password); // Create the user. User user = User.Register(displayName, email, hashedPassword); _userRepository.Save(user); // Create the user's default account. _accountService.CreateAccount(user.Id, "Default Account"); // Create the user's default watchlist. _watchlistService.CreateWatchlist(user.Id, "Default Watchlist", new[] { "BHP", "CBA", "TLS", "WOW" }); return(user.Id); }