/// <summary>
        /// Create a new <see cref="UserAreaOptions"/>, copying data from
        /// the specified <paramref name="settings"/>.
        /// </summary>
        /// <param name="settings">
        /// <see cref="UsersSettings"/> configuration to copy from.
        /// </param>
        public static UserAreaOptions CopyFrom(UsersSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            EntityInvalidOperationException.ThrowIfNull(settings, s => s.EmailAddress);
            EntityInvalidOperationException.ThrowIfNull(settings, s => s.Password);
            EntityInvalidOperationException.ThrowIfNull(settings, s => s.Username);
            EntityInvalidOperationException.ThrowIfNull(settings, s => s.Cookies);
            EntityInvalidOperationException.ThrowIfNull(settings, s => s.Authentication);
            EntityInvalidOperationException.ThrowIfNull(settings, s => s.AccountRecovery);
            EntityInvalidOperationException.ThrowIfNull(settings, s => s.AccountVerification);
            EntityInvalidOperationException.ThrowIfNull(settings, s => s.Cleanup);

            var options = new UserAreaOptions()
            {
                EmailAddress        = settings.EmailAddress.Clone(),
                Password            = settings.Password.Clone(),
                Username            = settings.Username.Clone(),
                Cookies             = settings.Cookies.Clone(),
                Authentication      = settings.Authentication.Clone(),
                AccountRecovery     = settings.AccountRecovery.Clone(),
                AccountVerification = settings.AccountVerification.Clone(),
                Cleanup             = settings.Cleanup.Clone()
            };

            return(options);
        }
Beispiel #2
0
 public void ConfigureOptions(UserAreaOptions options)
 {
     options.AccountRecovery.RecoveryUrlBase = "/" + _adminSetting.DirectoryName + "/auth/reset-password";
 }