From 8e4b33fd322490d7aa4fbb976616301c26f5d534 Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 28 Jun 2018 21:11:43 +0100 Subject: [PATCH 1/2] This should now fix #2350 --- src/Ombi/ApiKeyMiddlewear.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Ombi/ApiKeyMiddlewear.cs b/src/Ombi/ApiKeyMiddlewear.cs index 6110fedcc..f38317b3e 100644 --- a/src/Ombi/ApiKeyMiddlewear.cs +++ b/src/Ombi/ApiKeyMiddlewear.cs @@ -5,6 +5,7 @@ using System.Security.Principal; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; using Ombi.Core.Authentication; using Ombi.Core.Settings; using Ombi.Settings.Settings.Models; @@ -13,15 +14,11 @@ namespace Ombi { public class ApiKeyMiddlewear { - public ApiKeyMiddlewear(RequestDelegate next, ISettingsService repo, OmbiUserManager um) + public ApiKeyMiddlewear(RequestDelegate next) { _next = next; - _repo = repo; - _userManager = um; } private readonly RequestDelegate _next; - private readonly ISettingsService _repo; - private readonly OmbiUserManager _userManager; public async Task Invoke(HttpContext context) { @@ -66,8 +63,9 @@ namespace Ombi await context.Response.WriteAsync("Invalid User Access Token"); return; } - - var user = await _userManager.Users.FirstOrDefaultAsync(x => x.UserAccessToken == key); + + var um = context.RequestServices.GetService(); + var user = await um.Users.FirstOrDefaultAsync(x => x.UserAccessToken == key); if (user == null) { context.Response.StatusCode = (int)HttpStatusCode.Unauthorized; @@ -77,7 +75,7 @@ namespace Ombi { var identity = new GenericIdentity(user.UserName); - var roles = await _userManager.GetRolesAsync(user); + var roles = await um.GetRolesAsync(user); var principal = new GenericPrincipal(identity, roles.ToArray()); context.User = principal; await next.Invoke(context); @@ -86,7 +84,8 @@ namespace Ombi private async Task ValidateApiKey(HttpContext context, RequestDelegate next, string key) { - var ombiSettings = await _repo.GetSettingsAsync(); + var repo = context.RequestServices.GetService>(); + var ombiSettings = await repo.GetSettingsAsync(); var valid = ombiSettings.ApiKey.Equals(key, StringComparison.CurrentCultureIgnoreCase); if (!valid) { From fb7c7fdae3b18b6aa7566afdfce29c75eebc34fe Mon Sep 17 00:00:00 2001 From: Anojh Date: Fri, 29 Jun 2018 11:36:37 -0700 Subject: [PATCH 2/2] fix unclosed table tags causing overflow #2322 --- .../Templates/NewsletterTemplate.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Ombi.Notifications.Templates/Templates/NewsletterTemplate.html b/src/Ombi.Notifications.Templates/Templates/NewsletterTemplate.html index 81190334a..450e7df2a 100644 --- a/src/Ombi.Notifications.Templates/Templates/NewsletterTemplate.html +++ b/src/Ombi.Notifications.Templates/Templates/NewsletterTemplate.html @@ -182,14 +182,16 @@ - {@RECENTLYADDED} + {@RECENTLYADDED} + +