Potential fix for #2119

pull/2209/head
Jamie Rees 7 years ago
parent 1cb074586f
commit 28159cdf53

@ -20,23 +20,7 @@ export class CreateAdminComponent {
public createUser() { public createUser() {
this.identityService.createWizardUser({username: this.username, password: this.password, usePlexAdminAccount: false}).subscribe(x => { this.identityService.createWizardUser({username: this.username, password: this.password, usePlexAdminAccount: false}).subscribe(x => {
if (x) { if (x) {
// Log me in. this.router.navigate(["login"]);
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"]);
});
});
});
} else { } else {
this.notificationService.error("There was an error... You might want to put this on Github..."); this.notificationService.error("There was an error... You might want to put this on Github...");
} }

@ -32,25 +32,7 @@ export class PlexComponent {
usePlexAdminAccount: true, usePlexAdminAccount: true,
}).subscribe(y => { }).subscribe(y => {
if (y) { if (y) {
this.auth.login({ username: this.login, password: this.password, rememberMe: false, usePlexOAuth: false }).subscribe(c => { this.router.navigate(["login"]);
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"]);
});
});
});
});
});
} else { } else {
this.notificationService.error("Could not get the Plex Admin Information"); this.notificationService.error("Could not get the Plex Admin Information");
return; return;

@ -48,6 +48,7 @@ namespace Ombi.Controllers
public IdentityController(OmbiUserManager user, IMapper mapper, RoleManager<IdentityRole> rm, IEmailProvider prov, public IdentityController(OmbiUserManager user, IMapper mapper, RoleManager<IdentityRole> rm, IEmailProvider prov,
ISettingsService<EmailNotificationSettings> s, ISettingsService<EmailNotificationSettings> s,
ISettingsService<CustomizationSettings> c, ISettingsService<CustomizationSettings> c,
ISettingsService<OmbiSettings> ombiSettings,
IWelcomeEmail welcome, IWelcomeEmail welcome,
IMovieRequestRepository m, IMovieRequestRepository m,
ITvRequestRepository t, ITvRequestRepository t,
@ -73,6 +74,7 @@ namespace Ombi.Controllers
_issuesRepository = issues; _issuesRepository = issues;
_requestLogRepository = requestLog; _requestLogRepository = requestLog;
_issueCommentsRepository = issueComments; _issueCommentsRepository = issueComments;
OmbiSettings = ombiSettings;
} }
private OmbiUserManager UserManager { get; } private OmbiUserManager UserManager { get; }
@ -81,6 +83,7 @@ namespace Ombi.Controllers
private IEmailProvider EmailProvider { get; } private IEmailProvider EmailProvider { get; }
private ISettingsService<EmailNotificationSettings> EmailSettings { get; } private ISettingsService<EmailNotificationSettings> EmailSettings { get; }
private ISettingsService<CustomizationSettings> CustomizationSettings { get; } private ISettingsService<CustomizationSettings> CustomizationSettings { get; }
private ISettingsService<OmbiSettings> OmbiSettings { get; }
private IWelcomeEmail WelcomeEmail { get; } private IWelcomeEmail WelcomeEmail { get; }
private IMovieRequestRepository MovieRepo { get; } private IMovieRequestRepository MovieRepo { get; }
private ITvRequestRepository TvRepo { get; } private ITvRequestRepository TvRepo { get; }
@ -174,6 +177,12 @@ namespace Ombi.Controllers
{ {
LogErrors(result); LogErrors(result);
} }
// Update the wizard flag
var settings = await OmbiSettings.GetSettingsAsync();
settings.Wizard = true;
await OmbiSettings.SaveSettingsAsync(settings);
return result.Succeeded; return result.Succeeded;
} }

Loading…
Cancel
Save