mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-10 23:42:36 -07:00
Fixed #3143
This commit is contained in:
parent
19e46d4d17
commit
16ff5083c3
1 changed files with 13 additions and 10 deletions
|
@ -22,6 +22,14 @@ import { fadeInOutAnimation } from "../animations/fadeinout";
|
||||||
})
|
})
|
||||||
export class LoginComponent implements OnDestroy, OnInit {
|
export class LoginComponent implements OnDestroy, OnInit {
|
||||||
|
|
||||||
|
public get appName(): string {
|
||||||
|
if (this.customizationSettings.applicationName) {
|
||||||
|
return this.customizationSettings.applicationName;
|
||||||
|
} else {
|
||||||
|
return "Ombi";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public form: FormGroup;
|
public form: FormGroup;
|
||||||
public customizationSettings: ICustomizationSettings;
|
public customizationSettings: ICustomizationSettings;
|
||||||
public authenticationSettings: IAuthenticationSettings;
|
public authenticationSettings: IAuthenticationSettings;
|
||||||
|
@ -32,20 +40,14 @@ export class LoginComponent implements OnDestroy, OnInit {
|
||||||
public loginWithOmbi: boolean;
|
public loginWithOmbi: boolean;
|
||||||
public pinTimer: any;
|
public pinTimer: any;
|
||||||
|
|
||||||
public get appName(): string {
|
|
||||||
if (this.customizationSettings.applicationName) {
|
|
||||||
return this.customizationSettings.applicationName;
|
|
||||||
} else {
|
|
||||||
return "Ombi";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private timer: any;
|
private timer: any;
|
||||||
private clientId: string;
|
private clientId: string;
|
||||||
|
|
||||||
private errorBody: string;
|
private errorBody: string;
|
||||||
private errorValidation: string;
|
private errorValidation: string;
|
||||||
|
|
||||||
|
private oAuthWindow: Window|null;
|
||||||
|
|
||||||
constructor(private authService: AuthService, private router: Router, private notify: NotificationService, private status: StatusService,
|
constructor(private authService: AuthService, private router: Router, private notify: NotificationService, private status: StatusService,
|
||||||
private fb: FormBuilder, private settingsService: SettingsService, private images: ImageService, private sanitizer: DomSanitizer,
|
private fb: FormBuilder, private settingsService: SettingsService, private images: ImageService, private sanitizer: DomSanitizer,
|
||||||
private route: ActivatedRoute, private location: PlatformLocation, private translate: TranslateService, private plexTv: PlexTvService) {
|
private route: ActivatedRoute, private location: PlatformLocation, private translate: TranslateService, private plexTv: PlexTvService) {
|
||||||
|
@ -127,7 +129,7 @@ export class LoginComponent implements OnDestroy, OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public oauth() {
|
public oauth() {
|
||||||
const oAuthWindow = window.open(window.location.toString(), "_blank", `toolbar=0,
|
this.oAuthWindow = window.open(window.location.toString(), "_blank", `toolbar=0,
|
||||||
location=0,
|
location=0,
|
||||||
status=0,
|
status=0,
|
||||||
menubar=0,
|
menubar=0,
|
||||||
|
@ -138,7 +140,7 @@ export class LoginComponent implements OnDestroy, OnInit {
|
||||||
this.plexTv.GetPin(this.clientId, this.appName).subscribe((pin: any) => {
|
this.plexTv.GetPin(this.clientId, this.appName).subscribe((pin: any) => {
|
||||||
|
|
||||||
this.authService.login({ usePlexOAuth: true, password: "", rememberMe: true, username: "", plexTvPin: pin }).subscribe(x => {
|
this.authService.login({ usePlexOAuth: true, password: "", rememberMe: true, username: "", plexTvPin: pin }).subscribe(x => {
|
||||||
oAuthWindow!.location.replace(x.url);
|
this.oAuthWindow!.location.replace(x.url);
|
||||||
|
|
||||||
this.pinTimer = setInterval(() => {
|
this.pinTimer = setInterval(() => {
|
||||||
this.notify.info("Authenticating", "Loading... Please Wait");
|
this.notify.info("Authenticating", "Loading... Please Wait");
|
||||||
|
@ -155,6 +157,7 @@ export class LoginComponent implements OnDestroy, OnInit {
|
||||||
|
|
||||||
if (this.authService.loggedIn()) {
|
if (this.authService.loggedIn()) {
|
||||||
this.ngOnDestroy();
|
this.ngOnDestroy();
|
||||||
|
this.oAuthWindow.close();
|
||||||
this.router.navigate(["search"]);
|
this.router.navigate(["search"]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue