From 28159cdf5301322687b8d8796ca733aae89be4c8 Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Fri, 27 Apr 2018 20:49:18 +0100 Subject: [PATCH] Potential fix for #2119 --- .../createadmin/createadmin.component.ts | 18 +---------------- .../app/wizard/plex/plex.component.ts | 20 +------------------ src/Ombi/Controllers/IdentityController.cs | 9 +++++++++ 3 files changed, 11 insertions(+), 36 deletions(-) diff --git a/src/Ombi/ClientApp/app/wizard/createadmin/createadmin.component.ts b/src/Ombi/ClientApp/app/wizard/createadmin/createadmin.component.ts index 07f47f265..f36b7ee36 100644 --- a/src/Ombi/ClientApp/app/wizard/createadmin/createadmin.component.ts +++ b/src/Ombi/ClientApp/app/wizard/createadmin/createadmin.component.ts @@ -20,23 +20,7 @@ export class CreateAdminComponent { public createUser() { this.identityService.createWizardUser({username: this.username, password: this.password, usePlexAdminAccount: false}).subscribe(x => { if (x) { - // Log me in. - this.auth.login({ username: this.username, password: this.password, rememberMe: false, usePlexOAuth:false }).subscribe(c => { - - localStorage.setItem("id_token", c.access_token); - - // Mark that we have done the settings now - this.settings.getOmbi().subscribe(ombi => { - ombi.wizard = true; - - this.settings.saveOmbi(ombi).subscribe(x => { - - this.router.navigate(["search"]); - }); - - }); - - }); + this.router.navigate(["login"]); } else { this.notificationService.error("There was an error... You might want to put this on Github..."); } diff --git a/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts b/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts index bafe67756..6d3d8b69c 100644 --- a/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts +++ b/src/Ombi/ClientApp/app/wizard/plex/plex.component.ts @@ -32,25 +32,7 @@ export class PlexComponent { usePlexAdminAccount: true, }).subscribe(y => { if (y) { - this.auth.login({ username: this.login, password: this.password, rememberMe: false, usePlexOAuth: false }).subscribe(c => { - localStorage.setItem("id_token", c.access_token); - - // Mark that we have done the settings now - this.settings.getOmbi().subscribe(ombi => { - ombi.wizard = true; - - this.settings.saveOmbi(ombi).subscribe(s => { - this.settings.getUserManagementSettings().subscribe(usr => { - - usr.importPlexAdmin = true; - this.settings.saveUserManagementSettings(usr).subscribe(saved => { - this.router.navigate(["login"]); - }); - }); - - }); - }); - }); + this.router.navigate(["login"]); } else { this.notificationService.error("Could not get the Plex Admin Information"); return; diff --git a/src/Ombi/Controllers/IdentityController.cs b/src/Ombi/Controllers/IdentityController.cs index 8a9c76a34..ffaff8ff0 100644 --- a/src/Ombi/Controllers/IdentityController.cs +++ b/src/Ombi/Controllers/IdentityController.cs @@ -48,6 +48,7 @@ namespace Ombi.Controllers public IdentityController(OmbiUserManager user, IMapper mapper, RoleManager rm, IEmailProvider prov, ISettingsService s, ISettingsService c, + ISettingsService ombiSettings, IWelcomeEmail welcome, IMovieRequestRepository m, ITvRequestRepository t, @@ -73,6 +74,7 @@ namespace Ombi.Controllers _issuesRepository = issues; _requestLogRepository = requestLog; _issueCommentsRepository = issueComments; + OmbiSettings = ombiSettings; } private OmbiUserManager UserManager { get; } @@ -81,6 +83,7 @@ namespace Ombi.Controllers private IEmailProvider EmailProvider { get; } private ISettingsService EmailSettings { get; } private ISettingsService CustomizationSettings { get; } + private ISettingsService OmbiSettings { get; } private IWelcomeEmail WelcomeEmail { get; } private IMovieRequestRepository MovieRepo { get; } private ITvRequestRepository TvRepo { get; } @@ -174,6 +177,12 @@ namespace Ombi.Controllers { LogErrors(result); } + + // Update the wizard flag + var settings = await OmbiSettings.GetSettingsAsync(); + settings.Wizard = true; + await OmbiSettings.SaveSettingsAsync(settings); + return result.Succeeded; }