aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/login/login.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-03-28 18:22:59 +0200
committerChocobozzz <me@florianbigard.com>2018-03-28 18:22:59 +0200
commit2b084d7048a2d8a571d601916bdd21cef3a36311 (patch)
tree0cf646a0789889ba2bfa8a5f9ba49f41d6ddca9a /client/src/app/login/login.component.ts
parent5afdd0a52f2f1fa79ed9bf241b5a525366658fa1 (diff)
downloadPeerTube-2b084d7048a2d8a571d601916bdd21cef3a36311.tar.gz
PeerTube-2b084d7048a2d8a571d601916bdd21cef3a36311.tar.zst
PeerTube-2b084d7048a2d8a571d601916bdd21cef3a36311.zip
Add link to register in login form
Diffstat (limited to 'client/src/app/login/login.component.ts')
-rw-r--r--client/src/app/login/login.component.ts28
1 files changed, 17 insertions, 11 deletions
diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts
index 22e8c77dd..f7b49ec45 100644
--- a/client/src/app/login/login.component.ts
+++ b/client/src/app/login/login.component.ts
@@ -1,6 +1,7 @@
1import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' 1import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'
2import { FormBuilder, FormGroup, Validators } from '@angular/forms' 2import { FormBuilder, FormGroup, Validators } from '@angular/forms'
3import { Router } from '@angular/router' 3import { Router } from '@angular/router'
4import { RedirectService, ServerService } from '@app/core'
4import { UserService } from '@app/shared' 5import { UserService } from '@app/shared'
5import { NotificationsService } from 'angular2-notifications' 6import { NotificationsService } from 'angular2-notifications'
6import { ModalDirective } from 'ngx-bootstrap/modal' 7import { ModalDirective } from 'ngx-bootstrap/modal'
@@ -34,16 +35,20 @@ export class LoginComponent extends FormReactive implements OnInit {
34 } 35 }
35 forgotPasswordEmail = '' 36 forgotPasswordEmail = ''
36 37
37 constructor ( 38 constructor (private authService: AuthService,
38 private authService: AuthService, 39 private userService: UserService,
39 private userService: UserService, 40 private serverService: ServerService,
40 private notificationsService: NotificationsService, 41 private redirectService: RedirectService,
41 private formBuilder: FormBuilder, 42 private notificationsService: NotificationsService,
42 private router: Router 43 private formBuilder: FormBuilder,
43 ) { 44 private router: Router) {
44 super() 45 super()
45 } 46 }
46 47
48 get signupAllowed () {
49 return this.serverService.getConfig().signup.allowed === true
50 }
51
47 buildForm () { 52 buildForm () {
48 this.form = this.formBuilder.group({ 53 this.form = this.formBuilder.group({
49 username: [ '', Validators.required ], 54 username: [ '', Validators.required ],
@@ -62,11 +67,12 @@ export class LoginComponent extends FormReactive implements OnInit {
62 67
63 const { username, password } = this.form.value 68 const { username, password } = this.form.value
64 69
65 this.authService.login(username, password).subscribe( 70 this.authService.login(username, password)
66 () => this.router.navigate(['/videos/list']), 71 .subscribe(
72 () => this.redirectService.redirectToHomepage(),
67 73
68 err => this.error = err.message 74 err => this.error = err.message
69 ) 75 )
70 } 76 }
71 77
72 askResetPassword () { 78 askResetPassword () {