aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-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