diff --git a/src/Ombi/ClientApp/src/app/interfaces/IPlex.ts b/src/Ombi/ClientApp/src/app/interfaces/IPlex.ts
index de3fc8cf1..6afc13e21 100644
--- a/src/Ombi/ClientApp/src/app/interfaces/IPlex.ts
+++ b/src/Ombi/ClientApp/src/app/interfaces/IPlex.ts
@@ -14,6 +14,8 @@ export interface IPlexOAuthViewModel {
export interface IPlexOAuthAccessToken {
accessToken: string;
+ success: boolean;
+ error: string;
}
export interface IPlexUser {
diff --git a/src/Ombi/ClientApp/src/app/wizard/createadmin/createadmin.component.html b/src/Ombi/ClientApp/src/app/wizard/createadmin/createadmin.component.html
index 50371c346..ff44f7093 100644
--- a/src/Ombi/ClientApp/src/app/wizard/createadmin/createadmin.component.html
+++ b/src/Ombi/ClientApp/src/app/wizard/createadmin/createadmin.component.html
@@ -15,7 +15,7 @@
- You'll need to configure e-mail to recover any lost password!
+ You'll need to configure e-mail to reset your password!
diff --git a/src/Ombi/ClientApp/src/app/wizard/ombiconfig/ombiconfig.component.html b/src/Ombi/ClientApp/src/app/wizard/ombiconfig/ombiconfig.component.html
index fc51eae7c..33d15bb58 100644
--- a/src/Ombi/ClientApp/src/app/wizard/ombiconfig/ombiconfig.component.html
+++ b/src/Ombi/ClientApp/src/app/wizard/ombiconfig/ombiconfig.component.html
@@ -4,21 +4,22 @@
diff --git a/src/Ombi/ClientApp/src/app/wizard/ombiconfig/ombiconfig.component.ts b/src/Ombi/ClientApp/src/app/wizard/ombiconfig/ombiconfig.component.ts
index 9f1ac22f5..0b7e3863b 100644
--- a/src/Ombi/ClientApp/src/app/wizard/ombiconfig/ombiconfig.component.ts
+++ b/src/Ombi/ClientApp/src/app/wizard/ombiconfig/ombiconfig.component.ts
@@ -1,4 +1,6 @@
import { Component, Input } from "@angular/core";
+import { IOmbiConfigModel } from "../models/OmbiConfigModel";
+import { WizardService } from "../services/wizard.service";
@Component({
selector: "wizard-ombi",
@@ -7,5 +9,5 @@
})
export class OmbiConfigComponent {
- constructor() { }
+ @Input() public config: IOmbiConfigModel;
}
diff --git a/src/Ombi/ClientApp/src/app/wizard/plex/plex.component.html b/src/Ombi/ClientApp/src/app/wizard/plex/plex.component.html
index 4c3ee268a..611dc4500 100644
--- a/src/Ombi/ClientApp/src/app/wizard/plex/plex.component.html
+++ b/src/Ombi/ClientApp/src/app/wizard/plex/plex.component.html
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/src/Ombi/ClientApp/src/app/wizard/welcome/welcome.component.ts b/src/Ombi/ClientApp/src/app/wizard/welcome/welcome.component.ts
index 76bad5fb4..849977b55 100644
--- a/src/Ombi/ClientApp/src/app/wizard/welcome/welcome.component.ts
+++ b/src/Ombi/ClientApp/src/app/wizard/welcome/welcome.component.ts
@@ -1,37 +1,53 @@
-import { Component, OnInit } from "@angular/core";
+import { AfterViewInit, Component, OnInit, ViewChild } from "@angular/core";
import { Router } from "@angular/router";
import { ICreateWizardUser } from "../../interfaces";
import { IdentityService, NotificationService } from "../../services";
-
+import { IOmbiConfigModel } from "../models/OmbiConfigModel";
+import { WizardService } from "../services/wizard.service";
+import { MatHorizontalStepper } from'@angular/material/stepper';
+import { StepperSelectionEvent } from "@angular/cdk/stepper";
@Component({
templateUrl: "./welcome.component.html",
styleUrls: ["./welcome.component.scss"],
})
export class WelcomeComponent implements OnInit {
-
+
+ @ViewChild('stepper', {static: false}) public stepper: MatHorizontalStepper;
public localUser: ICreateWizardUser;
-
- constructor(private router: Router,
- private identityService: IdentityService, private notificationService: NotificationService) { }
+ public config: IOmbiConfigModel;
- public ngOnInit(): void {
+ constructor(private router: Router, private identityService: IdentityService,
+ private notificationService: NotificationService, private WizardService: WizardService) { }
+
+ public ngOnInit(): void {
this.localUser = {
password:"",
username:"",
usePlexAdminAccount:false
}
+ this.config = {
+ applicationName: null,
+ applicationUrl: null,
+ logo: null
+ };
}
public createUser() {
- this.identityService.createWizardUser(this.localUser).subscribe(x => {
- if (x.result) {
+ this.WizardService.addOmbiConfig(this.config).subscribe(config => {
+ if(config != null) {
+ this.identityService.createWizardUser(this.localUser).subscribe(x => {
+ if (x.result) {
+ // save the config
this.router.navigate(["login"]);
} else {
if (x.errors.length > 0) {
this.notificationService.error(x.errors[0]);
+ this.stepper.previous();
}
}
});
}
+ }, configErr => this.notificationService.error(configErr));
+ }
}
diff --git a/src/Ombi/Controllers/V1/IdentityController.cs b/src/Ombi/Controllers/V1/IdentityController.cs
index 63f8211ca..342e4620d 100644
--- a/src/Ombi/Controllers/V1/IdentityController.cs
+++ b/src/Ombi/Controllers/V1/IdentityController.cs
@@ -139,7 +139,7 @@ namespace Ombi.Controllers.V1
public async Task
CreateWizardUser([FromBody] CreateUserWizardModel user)
{
var users = UserManager.Users;
- if (users.Any(x => x.NormalizedUserName != "API"))
+ if (users.Any(x => x.UserType == UserType.LocalUser))
{
// No one should be calling this. Only the wizard
return new SaveWizardResult { Result = false, Errors = new List { "Looks like there is an existing user!" } };
@@ -169,7 +169,7 @@ namespace Ombi.Controllers.V1
ImportPlexAdmin = true
});
- return await SaveWizardUser(user, adminUser);
+ return await SaveWizardUser(user, adminUser, false);
}
var userToCreate = new OmbiUser
@@ -179,10 +179,10 @@ namespace Ombi.Controllers.V1
StreamingCountry = "US"
};
- return await SaveWizardUser(user, userToCreate);
+ return await SaveWizardUser(user, userToCreate, true);
}
- private async Task SaveWizardUser(CreateUserWizardModel user, OmbiUser userToCreate)
+ private async Task SaveWizardUser(CreateUserWizardModel user, OmbiUser userToCreate, bool completeWizard)
{
IdentityResult result;
var retVal = new SaveWizardResult();
@@ -210,10 +210,13 @@ namespace Ombi.Controllers.V1
_log.LogInformation("Added the Admin role");
}
- // Update the wizard flag
- var settings = await OmbiSettings.GetSettingsAsync();
- settings.Wizard = true;
- await OmbiSettings.SaveSettingsAsync(settings);
+ if (completeWizard)
+ {
+ // Update the wizard flag
+ var settings = await OmbiSettings.GetSettingsAsync();
+ settings.Wizard = true;
+ await OmbiSettings.SaveSettingsAsync(settings);
+ }
}
if (!result.Succeeded)
{