Added logging around creating the wizard user #1604

pull/1614/head
tidusjar 7 years ago
parent a74617b70c
commit d66e09b98f

@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Ombi.Attributes; using Ombi.Attributes;
@ -45,7 +46,8 @@ namespace Ombi.Controllers
ISettingsService<CustomizationSettings> c, ISettingsService<CustomizationSettings> c,
IWelcomeEmail welcome, IWelcomeEmail welcome,
IMovieRequestRepository m, IMovieRequestRepository m,
ITvRequestRepository t) ITvRequestRepository t,
ILogger<IdentityController> l)
{ {
UserManager = user; UserManager = user;
Mapper = mapper; Mapper = mapper;
@ -56,6 +58,7 @@ namespace Ombi.Controllers
WelcomeEmail = welcome; WelcomeEmail = welcome;
MovieRepo = m; MovieRepo = m;
TvRepo = t; TvRepo = t;
_log = l;
} }
private OmbiUserManager UserManager { get; } private OmbiUserManager UserManager { get; }
@ -67,6 +70,7 @@ namespace Ombi.Controllers
private IWelcomeEmail WelcomeEmail { get; } private IWelcomeEmail WelcomeEmail { get; }
private IMovieRequestRepository MovieRepo { get; } private IMovieRequestRepository MovieRepo { get; }
private ITvRequestRepository TvRepo { get; } private ITvRequestRepository TvRepo { get; }
private ILogger<IdentityController> _log;
/// <summary> /// <summary>
/// This is what the Wizard will call when creating the user for the very first time. /// This is what the Wizard will call when creating the user for the very first time.
@ -101,7 +105,13 @@ namespace Ombi.Controllers
await CreateRoles(); await CreateRoles();
await UserManager.AddToRoleAsync(userToCreate, OmbiRoles.Admin); await UserManager.AddToRoleAsync(userToCreate, OmbiRoles.Admin);
} }
if (!result.Succeeded)
{
foreach (var err in result.Errors)
{
_log.LogCritical(err.Description);
}
}
return result.Succeeded; return result.Succeeded;
} }

Loading…
Cancel
Save