aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/menu
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-03 17:04:47 +0100
committerChocobozzz <me@florianbigard.com>2021-12-03 17:04:47 +0100
commit0bc53e20296de68288481e2375b297626087174b (patch)
treea5d45a622932ee3539369dfeb9a84889176fd6f5 /client/src/app/menu
parentd1a233d8d86ead1e3aa2350d5480eab3336b17d6 (diff)
downloadPeerTube-0bc53e20296de68288481e2375b297626087174b.tar.gz
PeerTube-0bc53e20296de68288481e2375b297626087174b.tar.zst
PeerTube-0bc53e20296de68288481e2375b297626087174b.zip
Add ability to redirect users on external auth
Diffstat (limited to 'client/src/app/menu')
-rw-r--r--client/src/app/menu/menu.component.html4
-rw-r--r--client/src/app/menu/menu.component.ts10
2 files changed, 13 insertions, 1 deletions
diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html
index 55fc27b5f..9ea991042 100644
--- a/client/src/app/menu/menu.component.html
+++ b/client/src/app/menu/menu.component.html
@@ -99,7 +99,9 @@
99 </div> 99 </div>
100 100
101 <div *ngIf="!isLoggedIn" class="login-buttons-block"> 101 <div *ngIf="!isLoggedIn" class="login-buttons-block">
102 <a i18n routerLink="/login" class="peertube-button-link orange-button">Login</a> 102 <a i18n *ngIf="!getExternalLoginHref()" routerLink="/login" class="peertube-button-link orange-button">Login</a>
103 <a i18n *ngIf="getExternalLoginHref()" [href]="getExternalLoginHref()" class="peertube-button-link orange-button">Login</a>
104
103 <a i18n *ngIf="isRegistrationAllowed()" routerLink="/signup" class="peertube-button-link create-account-button">Create an account</a> 105 <a i18n *ngIf="isRegistrationAllowed()" routerLink="/signup" class="peertube-button-link create-account-button">Create an account</a>
104 </div> 106 </div>
105 107
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts
index 97f07c956..bcc884878 100644
--- a/client/src/app/menu/menu.component.ts
+++ b/client/src/app/menu/menu.component.ts
@@ -21,6 +21,7 @@ import { LanguageChooserComponent } from '@app/menu/language-chooser.component'
21import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component' 21import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component'
22import { PeertubeModalService } from '@app/shared/shared-main/peertube-modal/peertube-modal.service' 22import { PeertubeModalService } from '@app/shared/shared-main/peertube-modal/peertube-modal.service'
23import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' 23import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
24import { PluginsManager } from '@root-helpers/plugins-manager'
24import { HTMLServerConfig, ServerConfig, UserRight, VideoConstant } from '@shared/models' 25import { HTMLServerConfig, ServerConfig, UserRight, VideoConstant } from '@shared/models'
25 26
26const logger = debug('peertube:menu:MenuComponent') 27const logger = debug('peertube:menu:MenuComponent')
@@ -129,6 +130,15 @@ export class MenuComponent implements OnInit {
129 .subscribe(() => this.openQuickSettings()) 130 .subscribe(() => this.openQuickSettings())
130 } 131 }
131 132
133 getExternalLoginHref () {
134 if (this.serverConfig.client.menu.login.redirectOnSingleExternalAuth !== true) return undefined
135
136 const externalAuths = this.serverConfig.plugin.registeredExternalAuths
137 if (externalAuths.length !== 1) return undefined
138
139 return PluginsManager.getExternalAuthHref(externalAuths[0])
140 }
141
132 isRegistrationAllowed () { 142 isRegistrationAllowed () {
133 if (!this.serverConfig) return false 143 if (!this.serverConfig) return false
134 144