From 21e6dc811d18637dbadb31c724420361913dbc29 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 21 Jan 2020 10:52:22 +0100 Subject: [PATCH] Cleanup login form --- client/src/app/header/header.component.html | 2 +- client/src/app/header/header.component.ts | 31 +-------------------- client/src/app/login/login.component.html | 21 +++++--------- client/src/app/login/login.component.ts | 8 ------ 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 @@ > - + Upload 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' import { Component, OnInit } from '@angular/core' import { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router' import { getParameterByName } from '../shared/misc/utils' -import { AuthService, ServerService, Notifier } from '@app/core' +import { AuthService, Notifier, ServerService } from '@app/core' import { of } from 'rxjs' -import { ServerConfig } from '@shared/models' import { I18n } from '@ngx-translate/i18n-polyfill' @Component({ @@ -17,8 +16,6 @@ export class HeaderComponent implements OnInit { searchValue = '' ariaLabelTextForSearch = '' - private serverConfig: ServerConfig - constructor ( private router: Router, private route: ActivatedRoute, @@ -38,23 +35,6 @@ export class HeaderComponent implements OnInit { map(() => getParameterByName('search', window.location.href)) ) .subscribe(searchQuery => this.searchValue = searchQuery || '') - - this.serverConfig = this.serverService.getTmpConfig() - this.serverService.getConfig().subscribe( - config => this.serverConfig = config, - - err => this.notifier.error(err.message) - ) - } - - get routerLink () { - if (this.isUserLoggedIn()) { - return [ '/videos/upload' ] - } else if (this.isRegistrationAllowed()) { - return [ '/signup' ] - } else { - return [ '/login', { fromUpload: true } ] - } } doSearch () { @@ -73,15 +53,6 @@ export class HeaderComponent implements OnInit { o.subscribe(() => this.router.navigate([ '/search' ], { queryParams })) } - isUserLoggedIn () { - return this.authService.isLoggedIn() - } - - isRegistrationAllowed () { - return this.serverConfig.signup.allowed && - this.serverConfig.signup.allowedForCurrentIP - } - private loadUserLanguagesIfNeeded (queryParams: any) { if (queryParams && queryParams.languageOneOf) return of(queryParams) 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 @@ Login -
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 { error: string = null forgotPasswordEmail = '' - from = { - upload: false - } private openedForgotPasswordModal: NgbModalRef private serverConfig: ServerConfig @@ -47,17 +44,12 @@ export class LoginComponent extends FormReactive implements OnInit { return this.serverConfig.signup.allowed === true } - get instancesIndexUrl () { - return this.serverConfig.followings.instance.autoFollowIndex.indexUrl || 'https://instances.joinpeertube.org' - } - isEmailDisabled () { return this.serverConfig.email.enabled === false } ngOnInit () { this.serverConfig = this.route.snapshot.data.serverConfig - this.from.upload = Boolean(this.route.snapshot.paramMap.get('fromUpload')) this.buildForm({ username: this.loginValidatorsService.LOGIN_USERNAME,