diff --git a/src/Ombi/ClientApp/app/login/login.component.html b/src/Ombi/ClientApp/app/login/login.component.html
index 528fe9917..50d887feb 100644
--- a/src/Ombi/ClientApp/app/login/login.component.html
+++ b/src/Ombi/ClientApp/app/login/login.component.html
@@ -9,39 +9,50 @@ include the remember me checkbox
-
-
+
+
![]({{baseUrl}}/images/logo.png)
+
+
+
![]()
+
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Ombi/ClientApp/app/login/login.component.ts b/src/Ombi/ClientApp/app/login/login.component.ts
index 3c2636b2f..5bc5f022a 100644
--- a/src/Ombi/ClientApp/app/login/login.component.ts
+++ b/src/Ombi/ClientApp/app/login/login.component.ts
@@ -29,26 +29,8 @@ export class LoginComponent implements OnDestroy, OnInit {
public background: any;
public landingFlag: boolean;
public baseUrl: string;
-
- public get showLoginForm(): boolean {
- if(this.customizationSettings.applicationUrl && this.plexEnabled) {
- this.loginWithOmbi = false;
- return false;
- }
- if(!this.customizationSettings.applicationUrl || !this.plexEnabled) {
-
- this.loginWithOmbi = true;
- return true;
- }
- if(this.loginWithOmbi) {
- return true;
- }
-
- this.loginWithOmbi = true;
- return true;
- }
- public loginWithOmbi: boolean = false;
-
+ public loginWithOmbi: boolean;
+
public get appName(): string {
if(this.customizationSettings.applicationName) {
return this.customizationSettings.applicationName;
diff --git a/src/Ombi/ClientApp/app/login/loginoauth.component.html b/src/Ombi/ClientApp/app/login/loginoauth.component.html
index e80f1239f..e2118c7aa 100644
--- a/src/Ombi/ClientApp/app/login/loginoauth.component.html
+++ b/src/Ombi/ClientApp/app/login/loginoauth.component.html
@@ -4,6 +4,13 @@
diff --git a/src/Ombi/ClientApp/app/login/loginoauth.component.ts b/src/Ombi/ClientApp/app/login/loginoauth.component.ts
index 03922d8b3..1adcff19c 100644
--- a/src/Ombi/ClientApp/app/login/loginoauth.component.ts
+++ b/src/Ombi/ClientApp/app/login/loginoauth.component.ts
@@ -8,6 +8,7 @@ import { AuthService } from "../auth/auth.service";
})
export class LoginOAuthComponent implements OnInit {
public pin: number;
+ public error: string;
constructor(private authService: AuthService, private router: Router,
private route: ActivatedRoute) {
@@ -24,11 +25,17 @@ export class LoginOAuthComponent implements OnInit {
public auth() {
this.authService.oAuth(this.pin).subscribe(x => {
+ if(x.access_token) {
localStorage.setItem("id_token", x.access_token);
if (this.authService.loggedIn()) {
this.router.navigate(["search"]);
+ return;
}
+ }
+ if(x.errorMessage) {
+ this.error = x.errorMessage;
+ }
});
}
diff --git a/src/Ombi/Controllers/TokenController.cs b/src/Ombi/Controllers/TokenController.cs
index 624267989..b337b3f51 100644
--- a/src/Ombi/Controllers/TokenController.cs
+++ b/src/Ombi/Controllers/TokenController.cs
@@ -148,6 +148,15 @@ namespace Ombi.Controllers
{
var accessToken = await _plexOAuthManager.GetAccessTokenFromPin(pinId);
+ if (accessToken.IsNullOrEmpty())
+ {
+ // Looks like we are not authenticated.
+ return new JsonResult(new
+ {
+ errorMessage = "Could not authenticate with Plex"
+ });
+ }
+
// Let's look for the users account
var account = await _plexOAuthManager.GetAccount(accessToken);