diff options
author | Chocobozzz <me@florianbigard.com> | 2018-03-28 18:22:59 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-03-28 18:22:59 +0200 |
commit | 2b084d7048a2d8a571d601916bdd21cef3a36311 (patch) | |
tree | 0cf646a0789889ba2bfa8a5f9ba49f41d6ddca9a /client/src/app/login/login.component.ts | |
parent | 5afdd0a52f2f1fa79ed9bf241b5a525366658fa1 (diff) | |
download | PeerTube-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.ts | 28 |
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 @@ | |||
1 | import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' |
2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms' | 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms' |
3 | import { Router } from '@angular/router' | 3 | import { Router } from '@angular/router' |
4 | import { RedirectService, ServerService } from '@app/core' | ||
4 | import { UserService } from '@app/shared' | 5 | import { UserService } from '@app/shared' |
5 | import { NotificationsService } from 'angular2-notifications' | 6 | import { NotificationsService } from 'angular2-notifications' |
6 | import { ModalDirective } from 'ngx-bootstrap/modal' | 7 | import { 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 () { |