public VenueQueries( IVenueRepository venueRepository, IEntryLinkFactory entryLinkFactory, IUserPermissionContext permissionContext, IEnumTranslations enumTranslations, IUserIconFactory userIconFactory, IDiscordWebhookNotifier discordWebhookNotifier) : base(venueRepository, permissionContext) { _entryLinkFactory = entryLinkFactory; _enumTranslations = enumTranslations; _userIconFactory = userIconFactory; _discordWebhookNotifier = discordWebhookNotifier; }
public TagQueries( ITagRepository repository, IUserPermissionContext permissionContext, IEntryLinkFactory entryLinkFactory, IEntryThumbPersister imagePersister, IAggregatedEntryImageUrlFactory thumbStore, IUserIconFactory userIconFactory, IEnumTranslations enumTranslations, ObjectCache cache, IDiscordWebhookNotifier discordWebhookNotifier) : base(repository, permissionContext) { _entryLinkFactory = entryLinkFactory; _imagePersister = imagePersister; _thumbStore = thumbStore; _userIconFactory = userIconFactory; _enumTranslations = enumTranslations; _cache = cache; _discordWebhookNotifier = discordWebhookNotifier; }
public ArtistQueries( IArtistRepository repository, IUserPermissionContext permissionContext, IEntryLinkFactory entryLinkFactory, IEntryThumbPersister imagePersister, IEntryPictureFilePersister pictureFilePersister, ObjectCache cache, IUserIconFactory userIconFactory, IEnumTranslations enumTranslations, IAggregatedEntryImageUrlFactory imageUrlFactory, IDiscordWebhookNotifier discordWebhookNotifier) : base(repository, permissionContext) { _entryLinkFactory = entryLinkFactory; _imagePersister = imagePersister; _pictureFilePersister = pictureFilePersister; _cache = cache; _userIconFactory = userIconFactory; _enumTranslations = enumTranslations; _imageUrlFactory = imageUrlFactory; _discordWebhookNotifier = discordWebhookNotifier; }
public EventQueries( IEventRepository eventRepository, IEntryLinkFactory entryLinkFactory, IUserPermissionContext permissionContext, IEntryThumbPersister imagePersister, IUserIconFactory userIconFactory, IEnumTranslations enumTranslations, IUserMessageMailer mailer, IFollowedArtistNotifier followedArtistNotifier, IAggregatedEntryImageUrlFactory imageUrlFactory, IDiscordWebhookNotifier discordWebhookNotifier) : base(eventRepository, permissionContext) { _entryLinkFactory = entryLinkFactory; _imagePersister = imagePersister; _userIconFactory = userIconFactory; _enumTranslations = enumTranslations; _mailer = mailer; _followedArtistNotifier = followedArtistNotifier; _imageUrlFactory = imageUrlFactory; _discordWebhookNotifier = discordWebhookNotifier; }
public async Task <ActionResult> Create(RegisterModel model, [FromServices] IDiscordWebhookNotifier discordWebhookNotifier) { string restrictedErr = "Sorry, access from your host is restricted. It is possible this restriction is no longer valid. If you think this is the case, please contact support."; if (ModelState[nameof(model.Extra)].Errors.Any()) { s_log.Warn("An attempt was made to fill the bot decoy field from {0} with the value '{1}'.", Hostname, ModelState["Extra"]); _ipRuleManager.AddTempBannedIP(Hostname, "Attempt to fill the bot decoy field"); return(View(model)); } if (_config.SiteSettings.SignupsDisabled) { ModelState.AddModelError(string.Empty, "Signups are disabled"); } if (!string.IsNullOrEmpty(AppConfig.ReCAPTCHAKey)) { var recaptchaResult = await ReCaptcha2.ValidateAsync(new AspNetCoreHttpRequest(Request), AppConfig.ReCAPTCHAKey); if (!recaptchaResult.Success) { ErrorLogger.LogMessage(Request, $"Invalid CAPTCHA (error {recaptchaResult.Error})", LogLevel.Warn); _otherService.AuditLog("failed CAPTCHA", Hostname, AuditLogCategory.UserCreateFailCaptcha); ModelState.AddModelError("CAPTCHA", ViewRes.User.CreateStrings.CaptchaInvalid); } } if (!ModelState.IsValid) { return(View(model)); } if (!_ipRuleManager.IsAllowed(Hostname)) { s_log.Warn("Restricting blocked IP {0}.", Hostname); ModelState.AddModelError("Restricted", restrictedErr); return(View(model)); } var time = TimeSpan.FromTicks(DateTime.Now.Ticks - model.EntryTime); // Attempt to register the user try { var verifyEmailUrl = VocaUriBuilder.CreateAbsolute(Url.Action("VerifyEmail", "User")).ToString(); var user = await Data.Create( model.UserName, model.Password, model.Email ?? string.Empty, Hostname, Request.Headers[HeaderNames.UserAgent], WebHelper.GetInterfaceCultureName(Request), time, _ipRuleManager, verifyEmailUrl); await SetAuthCookieAsync(user.Name, createPersistentCookie : false); return(RedirectToAction("Index", "Home")); } catch (UserNameAlreadyExistsException) { ModelState.AddModelError("UserName", ViewRes.User.CreateStrings.UsernameTaken); return(View(model)); } catch (UserEmailAlreadyExistsException) { ModelState.AddModelError("Email", ViewRes.User.CreateStrings.EmailTaken); return(View(model)); } catch (InvalidEmailFormatException) { ModelState.AddModelError("Email", ViewRes.User.MySettingsStrings.InvalidEmail); return(View(model)); } catch (TooFastRegistrationException) { ModelState.AddModelError("Restricted", restrictedErr); return(View(model)); } catch (RestrictedIPException) { ModelState.AddModelError("Restricted", restrictedErr); return(View(model)); } }