aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/login
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-24 10:40:27 +0200
committerGitHub <noreply@github.com>2018-09-24 10:40:27 +0200
commit0b4e5fe32708afce54212810738aa4d0c3dc178d (patch)
tree5d9b160e257a2bd116e67c9363b798f422ead44c /client/src/app/login
parent23db998f07d674c621972a769df73203b14e093a (diff)
parent01448622992b12318a2fff508e501732b59dd6be (diff)
downloadPeerTube-0b4e5fe32708afce54212810738aa4d0c3dc178d.tar.gz
PeerTube-0b4e5fe32708afce54212810738aa4d0c3dc178d.tar.zst
PeerTube-0b4e5fe32708afce54212810738aa4d0c3dc178d.zip
Merge branch 'develop' into unused-imports
Diffstat (limited to 'client/src/app/login')
-rw-r--r--client/src/app/login/login.component.html2
-rw-r--r--client/src/app/login/login.component.ts13
2 files changed, 13 insertions, 2 deletions
diff --git a/client/src/app/login/login.component.html b/client/src/app/login/login.component.html
index 267a2d857..fa585c883 100644
--- a/client/src/app/login/login.component.html
+++ b/client/src/app/login/login.component.html
@@ -19,7 +19,7 @@
19 or create an account 19 or create an account
20 </a> 20 </a>
21 21
22 <a i18n *ngIf="signupAllowed === false" href="https://joinpeertube.org/en/#getting-started" target="_blank" title="Click here to see how to get started!" class="create-an-account"> 22 <a i18n *ngIf="signupAllowed === false" href="https://joinpeertube.org/en/#register" target="_blank" title="Click here to see a list of instances where to register" class="create-an-account">
23 or create an account on another instance 23 or create an account on another instance
24 </a> 24 </a>
25 25
diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts
index 4bae3ae5c..7553e6456 100644
--- a/client/src/app/login/login.component.ts
+++ b/client/src/app/login/login.component.ts
@@ -8,6 +8,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
8import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' 8import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
9import { LoginValidatorsService } from '@app/shared/forms/form-validators/login-validators.service' 9import { LoginValidatorsService } from '@app/shared/forms/form-validators/login-validators.service'
10import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' 10import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
11import { Router } from '@angular/router'
11 12
12@Component({ 13@Component({
13 selector: 'my-login', 14 selector: 'my-login',
@@ -26,6 +27,7 @@ export class LoginComponent extends FormReactive implements OnInit {
26 private openedForgotPasswordModal: NgbModalRef 27 private openedForgotPasswordModal: NgbModalRef
27 28
28 constructor ( 29 constructor (
30 public router: Router,
29 protected formValidatorService: FormValidatorService, 31 protected formValidatorService: FormValidatorService,
30 private modalService: NgbModal, 32 private modalService: NgbModal,
31 private loginValidatorsService: LoginValidatorsService, 33 private loginValidatorsService: LoginValidatorsService,
@@ -59,7 +61,7 @@ export class LoginComponent extends FormReactive implements OnInit {
59 61
60 this.authService.login(username, password) 62 this.authService.login(username, password)
61 .subscribe( 63 .subscribe(
62 () => this.redirectService.redirectToHomepage(), 64 () => this.redirect(),
63 65
64 err => { 66 err => {
65 if (err.message.indexOf('credentials are invalid') !== -1) this.error = this.i18n('Incorrect username or password.') 67 if (err.message.indexOf('credentials are invalid') !== -1) this.error = this.i18n('Incorrect username or password.')
@@ -69,6 +71,15 @@ export class LoginComponent extends FormReactive implements OnInit {
69 ) 71 )
70 } 72 }
71 73
74 redirect () {
75 const redirect = this.authService.redirectUrl
76 if (redirect) {
77 this.router.navigate([ redirect ])
78 } else {
79 this.redirectService.redirectToHomepage()
80 }
81 }
82
72 askResetPassword () { 83 askResetPassword () {
73 this.userService.askResetPassword(this.forgotPasswordEmail) 84 this.userService.askResetPassword(this.forgotPasswordEmail)
74 .subscribe( 85 .subscribe(