mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 16:52:56 -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">
|
||||
|
||||
<!-- <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"><img id="profile-img" class="center" [src]="customizationSettings.logo" /></div>
|
||||
<div *ngIf="!customizationSettings.logo">
|
||||
<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>
|
||||
|
||||
<div *ngIf="showLoginForm && loginWithOmbi">
|
||||
<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 *ngIf="!authenticationSettings.allowNoPassword" type="password" id="inputPassword" class="form-control" formControlName="password" [attr.placeholder]="'Login.PasswordPlaceholder' | translate">
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" id="RememberMe" formControlName="rememberMe" >
|
||||
|
||||
<label for="RememberMe" [translate]="'Login.RememberMe'"></label>
|
||||
|
||||
<div *ngIf="!plexEnabled || !customizationSettings.applicationUrl || loginWithOmbi">
|
||||
<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 *ngIf="!authenticationSettings.allowNoPassword" type="password" id="inputPassword" class="form-control" formControlName="password"
|
||||
[attr.placeholder]="'Login.PasswordPlaceholder' | translate">
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" id="RememberMe" formControlName="rememberMe">
|
||||
|
||||
<label for="RememberMe" [translate]="'Login.RememberMe'"></label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-success" type="submit" [translate]="'Login.SignInButton'"></button>
|
||||
</form><!-- /form -->
|
||||
</div>
|
||||
<div class="form-signin" *ngIf="plexEnabled && customizationSettings.applicationUrl && !loginWithOmbi">
|
||||
<button class="btn btn-success" type="button" (click)="loginWithOmbi = true">
|
||||
Continue With {{appName}}</button>
|
||||
<button class="btn btn-success" type="submit" [translate]="'Login.SignInButton'"></button>
|
||||
<a [routerLink]="['/reset']" class="forgot-password col-md-12">
|
||||
<b [translate]="'Login.ForgottenPassword'"></b>
|
||||
</a>
|
||||
</form>
|
||||
<!-- /form -->
|
||||
</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()">
|
||||
Continue With Plex</button>
|
||||
</div>
|
||||
|
||||
<a [routerLink]="['/reset']" class="forgot-password col-md-12">
|
||||
<b [translate]="'Login.ForgottenPassword'"></b>
|
||||
</a>
|
||||
</div><!-- /card-container -->
|
||||
</div><!-- /container -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /card-container -->
|
||||
</div>
|
||||
<!-- /container -->
|
||||
</div>
|
|
@ -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;
|
||||
|
|
|
@ -4,6 +4,13 @@
|
|||
<div class="container" id="login">
|
||||
<div class="card card-container">
|
||||
<label>Please Wait...</label>
|
||||
|
||||
<div *ngIf="error">
|
||||
<label>{{error}}</label>
|
||||
|
||||
<a [routerLink]="['/login']">
|
||||
Back </a>
|
||||
</div>
|
||||
</div><!-- /card-container -->
|
||||
</div><!-- /container -->
|
||||
</div>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue