aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/signup/signup.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-11-16 17:06:19 +0100
committerChocobozzz <me@florianbigard.com>2018-11-16 17:06:19 +0100
commit43e9d2af7d3525bc709e4c6d15fe85f65795f5fa (patch)
treedf1cd014a6dfbe7627ce67562fd8dbcd9ccc4749 /client/src/app/signup/signup.component.ts
parentd8c9996ce2b4de3ef1f2d36f63e461006bab58ed (diff)
downloadPeerTube-43e9d2af7d3525bc709e4c6d15fe85f65795f5fa.tar.gz
PeerTube-43e9d2af7d3525bc709e4c6d15fe85f65795f5fa.tar.zst
PeerTube-43e9d2af7d3525bc709e4c6d15fe85f65795f5fa.zip
Auto login user on signup
Diffstat (limited to 'client/src/app/signup/signup.component.ts')
-rw-r--r--client/src/app/signup/signup.component.ts22
1 files changed, 16 insertions, 6 deletions
diff --git a/client/src/app/signup/signup.component.ts b/client/src/app/signup/signup.component.ts
index 607d64893..3341d4e09 100644
--- a/client/src/app/signup/signup.component.ts
+++ b/client/src/app/signup/signup.component.ts
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'
2import { NotificationsService } from 'angular2-notifications' 2import { NotificationsService } from 'angular2-notifications'
3import { UserCreate } from '../../../../shared' 3import { UserCreate } from '../../../../shared'
4import { FormReactive, UserService, UserValidatorsService } from '../shared' 4import { FormReactive, UserService, UserValidatorsService } from '../shared'
5import { RedirectService, ServerService } from '@app/core' 5import { AuthService, RedirectService, ServerService } from '@app/core'
6import { I18n } from '@ngx-translate/i18n-polyfill' 6import { I18n } from '@ngx-translate/i18n-polyfill'
7import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' 7import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
8 8
@@ -18,6 +18,7 @@ export class SignupComponent extends FormReactive implements OnInit {
18 18
19 constructor ( 19 constructor (
20 protected formValidatorService: FormValidatorService, 20 protected formValidatorService: FormValidatorService,
21 private authService: AuthService,
21 private userValidatorsService: UserValidatorsService, 22 private userValidatorsService: UserValidatorsService,
22 private notificationsService: NotificationsService, 23 private notificationsService: NotificationsService,
23 private userService: UserService, 24 private userService: UserService,
@@ -59,11 +60,20 @@ export class SignupComponent extends FormReactive implements OnInit {
59 return 60 return
60 } 61 }
61 62
62 this.notificationsService.success( 63 // Auto login
63 this.i18n('Success'), 64 this.authService.login(userCreate.username, userCreate.password)
64 this.i18n('Registration for {{username}} complete.', { username: userCreate.username }) 65 .subscribe(
65 ) 66 () => {
66 this.redirectService.redirectToHomepage() 67 this.notificationsService.success(
68 this.i18n('Success'),
69 this.i18n('You are now logged in as {{username}}!', { username: userCreate.username })
70 )
71
72 this.redirectService.redirectToHomepage()
73 },
74
75 err => this.error = err.message
76 )
67 }, 77 },
68 78
69 err => this.error = err.message 79 err => this.error = err.message