mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-14 01:02:57 -07:00
Fixed the ombi login button !wip
This commit is contained in:
parent
4e8daeecd7
commit
2c08908c8b
5 changed files with 64 additions and 48 deletions
|
@ -9,39 +9,50 @@ include the remember me checkbox
|
||||||
<div class="card card-container">
|
<div class="card card-container">
|
||||||
|
|
||||||
<!-- <img class="profile-img-card" src="//lh3.googleusercontent.com/-6V8xOA6M7BA/AAAAAAAAAAI/AAAAAAAAAAA/rzlHcD0KYwo/photo.jpg?sz=120" alt="" /> -->
|
<!-- <img class="profile-img-card" src="//lh3.googleusercontent.com/-6V8xOA6M7BA/AAAAAAAAAAI/AAAAAAAAAAA/rzlHcD0KYwo/photo.jpg?sz=120" alt="" /> -->
|
||||||
<div *ngIf="!customizationSettings.logo"><img id="profile-img" class="profile-img-card" src="{{baseUrl}}/images/logo.png"/></div>
|
<div *ngIf="!customizationSettings.logo">
|
||||||
<div *ngIf="customizationSettings.logo"><img id="profile-img" class="center" [src]="customizationSettings.logo" /></div>
|
<img id="profile-img" class="profile-img-card" src="{{baseUrl}}/images/logo.png" />
|
||||||
|
</div>
|
||||||
|
<div *ngIf="customizationSettings.logo">
|
||||||
|
<img id="profile-img" class="center" [src]="customizationSettings.logo" />
|
||||||
|
</div>
|
||||||
<p id="profile-name" class="profile-name-card"></p>
|
<p id="profile-name" class="profile-name-card"></p>
|
||||||
|
|
||||||
<div *ngIf="showLoginForm && loginWithOmbi">
|
<div *ngIf="!plexEnabled || !customizationSettings.applicationUrl || loginWithOmbi">
|
||||||
<form *ngIf="authenticationSettings" class="form-signin" novalidate [formGroup]="form" (ngSubmit)="onSubmit(form)">
|
<form *ngIf="authenticationSettings" class="form-signin" novalidate [formGroup]="form" (ngSubmit)="onSubmit(form)">
|
||||||
|
|
||||||
|
|
||||||
<input type="email" id="inputEmail" class="form-control" formControlName="username" [attr.placeholder]="'Login.UsernamePlaceholder' | translate" autofocus>
|
<input type="email" id="inputEmail" class="form-control" formControlName="username" [attr.placeholder]="'Login.UsernamePlaceholder' | translate"
|
||||||
<input *ngIf="!authenticationSettings.allowNoPassword" type="password" id="inputPassword" class="form-control" formControlName="password" [attr.placeholder]="'Login.PasswordPlaceholder' | translate">
|
autofocus>
|
||||||
<div class="form-group">
|
<input *ngIf="!authenticationSettings.allowNoPassword" type="password" id="inputPassword" class="form-control" formControlName="password"
|
||||||
<div class="checkbox">
|
[attr.placeholder]="'Login.PasswordPlaceholder' | translate">
|
||||||
<input type="checkbox" id="RememberMe" formControlName="rememberMe" >
|
<div class="form-group">
|
||||||
|
<div class="checkbox">
|
||||||
<label for="RememberMe" [translate]="'Login.RememberMe'"></label>
|
<input type="checkbox" id="RememberMe" formControlName="rememberMe">
|
||||||
|
|
||||||
|
<label for="RememberMe" [translate]="'Login.RememberMe'"></label>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<button class="btn btn-success" type="submit" [translate]="'Login.SignInButton'"></button>
|
||||||
<button class="btn btn-success" type="submit" [translate]="'Login.SignInButton'"></button>
|
<a [routerLink]="['/reset']" class="forgot-password col-md-12">
|
||||||
</form><!-- /form -->
|
<b [translate]="'Login.ForgottenPassword'"></b>
|
||||||
</div>
|
</a>
|
||||||
<div class="form-signin" *ngIf="plexEnabled && customizationSettings.applicationUrl && !loginWithOmbi">
|
</form>
|
||||||
<button class="btn btn-success" type="button" (click)="loginWithOmbi = true">
|
<!-- /form -->
|
||||||
Continue With {{appName}}</button>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-signin" *ngIf="plexEnabled && customizationSettings.applicationUrl && !loginWithOmbi">
|
<!-- Main OAuth Flow -->
|
||||||
|
<div class="form-signin" *ngIf="plexEnabled && customizationSettings.applicationUrl && !loginWithOmbi">
|
||||||
|
<button class="btn btn-success" type="button" (click)="loginWithOmbi = true">
|
||||||
|
Login With {{appName}}</button>
|
||||||
|
</div>
|
||||||
|
<div class="form-signin" *ngIf="plexEnabled && customizationSettings.applicationUrl && !loginWithOmbi">
|
||||||
<button class="btn btn-primary" type="button" (click)="oauth()">
|
<button class="btn btn-primary" type="button" (click)="oauth()">
|
||||||
Continue With Plex</button>
|
Continue With Plex</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a [routerLink]="['/reset']" class="forgot-password col-md-12">
|
|
||||||
<b [translate]="'Login.ForgottenPassword'"></b>
|
</div>
|
||||||
</a>
|
<!-- /card-container -->
|
||||||
</div><!-- /card-container -->
|
</div>
|
||||||
</div><!-- /container -->
|
<!-- /container -->
|
||||||
</div>
|
</div>
|
|
@ -29,26 +29,8 @@ export class LoginComponent implements OnDestroy, OnInit {
|
||||||
public background: any;
|
public background: any;
|
||||||
public landingFlag: boolean;
|
public landingFlag: boolean;
|
||||||
public baseUrl: string;
|
public baseUrl: string;
|
||||||
|
public loginWithOmbi: boolean;
|
||||||
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 get appName(): string {
|
public get appName(): string {
|
||||||
if(this.customizationSettings.applicationName) {
|
if(this.customizationSettings.applicationName) {
|
||||||
return this.customizationSettings.applicationName;
|
return this.customizationSettings.applicationName;
|
||||||
|
|
|
@ -4,6 +4,13 @@
|
||||||
<div class="container" id="login">
|
<div class="container" id="login">
|
||||||
<div class="card card-container">
|
<div class="card card-container">
|
||||||
<label>Please Wait...</label>
|
<label>Please Wait...</label>
|
||||||
|
|
||||||
|
<div *ngIf="error">
|
||||||
|
<label>{{error}}</label>
|
||||||
|
|
||||||
|
<a [routerLink]="['/login']">
|
||||||
|
Back </a>
|
||||||
|
</div>
|
||||||
</div><!-- /card-container -->
|
</div><!-- /card-container -->
|
||||||
</div><!-- /container -->
|
</div><!-- /container -->
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { AuthService } from "../auth/auth.service";
|
||||||
})
|
})
|
||||||
export class LoginOAuthComponent implements OnInit {
|
export class LoginOAuthComponent implements OnInit {
|
||||||
public pin: number;
|
public pin: number;
|
||||||
|
public error: string;
|
||||||
|
|
||||||
constructor(private authService: AuthService, private router: Router,
|
constructor(private authService: AuthService, private router: Router,
|
||||||
private route: ActivatedRoute) {
|
private route: ActivatedRoute) {
|
||||||
|
@ -24,11 +25,17 @@ export class LoginOAuthComponent implements OnInit {
|
||||||
|
|
||||||
public auth() {
|
public auth() {
|
||||||
this.authService.oAuth(this.pin).subscribe(x => {
|
this.authService.oAuth(this.pin).subscribe(x => {
|
||||||
|
if(x.access_token) {
|
||||||
localStorage.setItem("id_token", x.access_token);
|
localStorage.setItem("id_token", x.access_token);
|
||||||
|
|
||||||
if (this.authService.loggedIn()) {
|
if (this.authService.loggedIn()) {
|
||||||
this.router.navigate(["search"]);
|
this.router.navigate(["search"]);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(x.errorMessage) {
|
||||||
|
this.error = x.errorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,6 +148,15 @@ namespace Ombi.Controllers
|
||||||
{
|
{
|
||||||
var accessToken = await _plexOAuthManager.GetAccessTokenFromPin(pinId);
|
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
|
// Let's look for the users account
|
||||||
var account = await _plexOAuthManager.GetAccount(accessToken);
|
var account = await _plexOAuthManager.GetAccount(accessToken);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue