aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/menu
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-02-14 11:47:01 +0100
committerChocobozzz <me@florianbigard.com>2023-02-14 11:51:44 +0100
commit98bd5e2256bfdeba6d5ab07f0421acfde1a0de26 (patch)
treea1193f1af10f0da7a532d4aa6d5045e51c3d16a9 /client/src/app/menu
parent4ea827076df39935375d66fffb5e1e27e667111e (diff)
downloadPeerTube-98bd5e2256bfdeba6d5ab07f0421acfde1a0de26.tar.gz
PeerTube-98bd5e2256bfdeba6d5ab07f0421acfde1a0de26.tar.zst
PeerTube-98bd5e2256bfdeba6d5ab07f0421acfde1a0de26.zip
Refactor login redirection/button links
Correctly handle external auth redirection in all cases
Diffstat (limited to 'client/src/app/menu')
-rw-r--r--client/src/app/menu/menu.component.html3
-rw-r--r--client/src/app/menu/menu.component.scss3
-rw-r--r--client/src/app/menu/menu.component.ts6
3 files changed, 3 insertions, 9 deletions
diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html
index abfc151e7..0fb9897b9 100644
--- a/client/src/app/menu/menu.component.html
+++ b/client/src/app/menu/menu.component.html
@@ -100,8 +100,7 @@
100 </div> 100 </div>
101 101
102 <div *ngIf="!isLoggedIn" class="login-buttons-block"> 102 <div *ngIf="!isLoggedIn" class="login-buttons-block">
103 <a i18n *ngIf="!getExternalLoginHref()" routerLink="/login" class="peertube-button-link orange-button">Login</a> 103 <my-login-link className="peertube-button-link orange-button w-100"></my-login-link>
104 <a i18n *ngIf="getExternalLoginHref()" [href]="getExternalLoginHref()" class="peertube-button-link orange-button">Login</a>
105 104
106 <a *ngIf="isRegistrationAllowed()" routerLink="/signup" class="peertube-button-link create-account-button"> 105 <a *ngIf="isRegistrationAllowed()" routerLink="/signup" class="peertube-button-link create-account-button">
107 <my-signup-label [requiresApproval]="requiresApproval"></my-signup-label> 106 <my-signup-label [requiresApproval]="requiresApproval"></my-signup-label>
diff --git a/client/src/app/menu/menu.component.scss b/client/src/app/menu/menu.component.scss
index cd57e134e..9d5ad57c2 100644
--- a/client/src/app/menu/menu.component.scss
+++ b/client/src/app/menu/menu.component.scss
@@ -251,7 +251,8 @@ my-actor-avatar {
251.login-buttons-block { 251.login-buttons-block {
252 margin: 30px 25px 35px; 252 margin: 30px 25px 35px;
253 253
254 > a { 254 > a,
255 > my-login-link {
255 display: block; 256 display: block;
256 width: 100%; 257 width: 100%;
257 258
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts
index fc6d74cff..21354e52d 100644
--- a/client/src/app/menu/menu.component.ts
+++ b/client/src/app/menu/menu.component.ts
@@ -1,7 +1,6 @@
1import { HotkeysService } from 'angular2-hotkeys' 1import { HotkeysService } from 'angular2-hotkeys'
2import * as debug from 'debug' 2import * as debug from 'debug'
3import { switchMap } from 'rxjs/operators' 3import { switchMap } from 'rxjs/operators'
4import { environment } from 'src/environments/environment'
5import { ViewportScroller } from '@angular/common' 4import { ViewportScroller } from '@angular/common'
6import { Component, OnInit, ViewChild } from '@angular/core' 5import { Component, OnInit, ViewChild } from '@angular/core'
7import { Router } from '@angular/router' 6import { Router } from '@angular/router'
@@ -22,7 +21,6 @@ import { LanguageChooserComponent } from '@app/menu/language-chooser.component'
22import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component' 21import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component'
23import { PeertubeModalService } from '@app/shared/shared-main/peertube-modal/peertube-modal.service' 22import { PeertubeModalService } from '@app/shared/shared-main/peertube-modal/peertube-modal.service'
24import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' 23import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
25import { PluginsManager } from '@root-helpers/plugins-manager'
26import { HTMLServerConfig, ServerConfig, UserRight, VideoConstant } from '@shared/models' 24import { HTMLServerConfig, ServerConfig, UserRight, VideoConstant } from '@shared/models'
27 25
28const debugLogger = debug('peertube:menu:MenuComponent') 26const debugLogger = debug('peertube:menu:MenuComponent')
@@ -135,10 +133,6 @@ export class MenuComponent implements OnInit {
135 .subscribe(() => this.openQuickSettings()) 133 .subscribe(() => this.openQuickSettings())
136 } 134 }
137 135
138 getExternalLoginHref () {
139 return PluginsManager.getDefaultLoginHref(environment.apiUrl, this.serverConfig)
140 }
141
142 isRegistrationAllowed () { 136 isRegistrationAllowed () {
143 if (!this.serverConfig) return false 137 if (!this.serverConfig) return false
144 138