aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/app/header/header.component.html2
-rw-r--r--client/src/app/header/header.component.ts31
-rw-r--r--client/src/app/login/login.component.html21
-rw-r--r--client/src/app/login/login.component.ts8
4 files changed, 9 insertions, 53 deletions
diff --git a/client/src/app/header/header.component.html b/client/src/app/header/header.component.html
index 1bdfe9858..4fd18f9bd 100644
--- a/client/src/app/header/header.component.html
+++ b/client/src/app/header/header.component.html
@@ -4,7 +4,7 @@
4> 4>
5<span (click)="doSearch()" class="icon icon-search"></span> 5<span (click)="doSearch()" class="icon icon-search"></span>
6 6
7<a class="upload-button" [routerLink]="routerLink"> 7<a class="upload-button" routerLink="/videos/upload">
8 <my-global-icon iconName="upload"></my-global-icon> 8 <my-global-icon iconName="upload"></my-global-icon>
9 <span i18n class="upload-button-label">Upload</span> 9 <span i18n class="upload-button-label">Upload</span>
10</a> 10</a>
diff --git a/client/src/app/header/header.component.ts b/client/src/app/header/header.component.ts
index 5fd122930..92a7eded6 100644
--- a/client/src/app/header/header.component.ts
+++ b/client/src/app/header/header.component.ts
@@ -2,9 +2,8 @@ import { filter, first, map, tap } from 'rxjs/operators'
2import { Component, OnInit } from '@angular/core' 2import { Component, OnInit } from '@angular/core'
3import { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router' 3import { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router'
4import { getParameterByName } from '../shared/misc/utils' 4import { getParameterByName } from '../shared/misc/utils'
5import { AuthService, ServerService, Notifier } from '@app/core' 5import { AuthService, Notifier, ServerService } from '@app/core'
6import { of } from 'rxjs' 6import { of } from 'rxjs'
7import { ServerConfig } from '@shared/models'
8import { I18n } from '@ngx-translate/i18n-polyfill' 7import { I18n } from '@ngx-translate/i18n-polyfill'
9 8
10@Component({ 9@Component({
@@ -17,8 +16,6 @@ export class HeaderComponent implements OnInit {
17 searchValue = '' 16 searchValue = ''
18 ariaLabelTextForSearch = '' 17 ariaLabelTextForSearch = ''
19 18
20 private serverConfig: ServerConfig
21
22 constructor ( 19 constructor (
23 private router: Router, 20 private router: Router,
24 private route: ActivatedRoute, 21 private route: ActivatedRoute,
@@ -38,23 +35,6 @@ export class HeaderComponent implements OnInit {
38 map(() => getParameterByName('search', window.location.href)) 35 map(() => getParameterByName('search', window.location.href))
39 ) 36 )
40 .subscribe(searchQuery => this.searchValue = searchQuery || '') 37 .subscribe(searchQuery => this.searchValue = searchQuery || '')
41
42 this.serverConfig = this.serverService.getTmpConfig()
43 this.serverService.getConfig().subscribe(
44 config => this.serverConfig = config,
45
46 err => this.notifier.error(err.message)
47 )
48 }
49
50 get routerLink () {
51 if (this.isUserLoggedIn()) {
52 return [ '/videos/upload' ]
53 } else if (this.isRegistrationAllowed()) {
54 return [ '/signup' ]
55 } else {
56 return [ '/login', { fromUpload: true } ]
57 }
58 } 38 }
59 39
60 doSearch () { 40 doSearch () {
@@ -73,15 +53,6 @@ export class HeaderComponent implements OnInit {
73 o.subscribe(() => this.router.navigate([ '/search' ], { queryParams })) 53 o.subscribe(() => this.router.navigate([ '/search' ], { queryParams }))
74 } 54 }
75 55
76 isUserLoggedIn () {
77 return this.authService.isLoggedIn()
78 }
79
80 isRegistrationAllowed () {
81 return this.serverConfig.signup.allowed &&
82 this.serverConfig.signup.allowedForCurrentIP
83 }
84
85 private loadUserLanguagesIfNeeded (queryParams: any) { 56 private loadUserLanguagesIfNeeded (queryParams: any) {
86 if (queryParams && queryParams.languageOneOf) return of(queryParams) 57 if (queryParams && queryParams.languageOneOf) return of(queryParams)
87 58
diff --git a/client/src/app/login/login.component.html b/client/src/app/login/login.component.html
index 6c6a41c4a..0b0bacff0 100644
--- a/client/src/app/login/login.component.html
+++ b/client/src/app/login/login.component.html
@@ -3,15 +3,18 @@
3 Login 3 Login
4 </div> 4 </div>
5 5
6 <div class="alert alert-warning" *ngIf="from.upload" role="alert"> 6 <div class="alert alert-info" *ngIf="signupAllowed === false" role="alert">
7 <h6 class="alert-heading" i18n> 7 <h6 class="alert-heading" i18n>
8 If you are looking for an account… 8 If you are looking for an account…
9 </h6> 9 </h6>
10
10 <div i18n> 11 <div i18n>
11 Currently this instance doesn't allow for user registration, but you can find an instance 12 Currently this instance doesn't allow for user registration, but you can find an instance
12 that gives you the possibility to sign up for an account and upload your videos there. 13 that gives you the possibility to sign up for an account and upload your videos there.
13 Find yours among multiple instances at <a class="alert-link" [href]="instancesIndexUrl" target="_blank" rel="noopener noreferrer">{{ instancesIndexUrl }}</a> 14
14 , a directory of instances recommended by this instance. 15 <br />
16
17 Find yours among multiple instances at <a class="alert-link" href="https://joinpeertube.org/instances" target="_blank" rel="noopener noreferrer">https://joinpeertube.org/instances</a>.
15 </div> 18 </div>
16 </div> 19 </div>
17 20
@@ -30,16 +33,6 @@
30 <a i18n *ngIf="signupAllowed === true" routerLink="/signup" class="create-an-account"> 33 <a i18n *ngIf="signupAllowed === true" routerLink="/signup" class="create-an-account">
31 or create an account 34 or create an account
32 </a> 35 </a>
33
34 <a i18n *ngIf="signupAllowed === false" href="https://joinpeertube.org/instances#instances-list" target="_blank" title="Click here to see a list of instances where to register" class="create-an-account">
35 or create an account on another instance
36 </a>
37
38 <my-help *ngIf="signupAllowed === false">
39 <ng-template ptTemplate="customHtml">
40 <ng-container i18n>User registration is not allowed on this instance, but you can register on many others!</ng-container>
41 </ng-template>
42 </my-help>
43 </div> 36 </div>
44 37
45 <div *ngIf="formErrors.username" class="form-error"> 38 <div *ngIf="formErrors.username" class="form-error">
diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts
index 1394d6b58..580f28822 100644
--- a/client/src/app/login/login.component.ts
+++ b/client/src/app/login/login.component.ts
@@ -22,9 +22,6 @@ export class LoginComponent extends FormReactive implements OnInit {
22 22
23 error: string = null 23 error: string = null
24 forgotPasswordEmail = '' 24 forgotPasswordEmail = ''
25 from = {
26 upload: false
27 }
28 25
29 private openedForgotPasswordModal: NgbModalRef 26 private openedForgotPasswordModal: NgbModalRef
30 private serverConfig: ServerConfig 27 private serverConfig: ServerConfig
@@ -47,17 +44,12 @@ export class LoginComponent extends FormReactive implements OnInit {
47 return this.serverConfig.signup.allowed === true 44 return this.serverConfig.signup.allowed === true
48 } 45 }
49 46
50 get instancesIndexUrl () {
51 return this.serverConfig.followings.instance.autoFollowIndex.indexUrl || 'https://instances.joinpeertube.org'
52 }
53
54 isEmailDisabled () { 47 isEmailDisabled () {
55 return this.serverConfig.email.enabled === false 48 return this.serverConfig.email.enabled === false
56 } 49 }
57 50
58 ngOnInit () { 51 ngOnInit () {
59 this.serverConfig = this.route.snapshot.data.serverConfig 52 this.serverConfig = this.route.snapshot.data.serverConfig
60 this.from.upload = Boolean(this.route.snapshot.paramMap.get('fromUpload'))
61 53
62 this.buildForm({ 54 this.buildForm({
63 username: this.loginValidatorsService.LOGIN_USERNAME, 55 username: this.loginValidatorsService.LOGIN_USERNAME,