aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/signup/signup.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/signup/signup.component.ts')
-rw-r--r--client/src/app/signup/signup.component.ts22
1 files changed, 17 insertions, 5 deletions
diff --git a/client/src/app/signup/signup.component.ts b/client/src/app/signup/signup.component.ts
index 47f9bc6f4..16e444678 100644
--- a/client/src/app/signup/signup.component.ts
+++ b/client/src/app/signup/signup.component.ts
@@ -3,7 +3,7 @@ import { Router } from '@angular/router'
3import { NotificationsService } from 'angular2-notifications' 3import { NotificationsService } from 'angular2-notifications'
4import { UserCreate } from '../../../../shared' 4import { UserCreate } from '../../../../shared'
5import { FormReactive, UserService, UserValidatorsService } from '../shared' 5import { FormReactive, UserService, UserValidatorsService } from '../shared'
6import { RedirectService } from '@app/core' 6import { RedirectService, ServerService } from '@app/core'
7import { I18n } from '@ngx-translate/i18n-polyfill' 7import { 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'
9 9
@@ -21,6 +21,7 @@ export class SignupComponent extends FormReactive implements OnInit {
21 private router: Router, 21 private router: Router,
22 private notificationsService: NotificationsService, 22 private notificationsService: NotificationsService,
23 private userService: UserService, 23 private userService: UserService,
24 private serverService: ServerService,
24 private redirectService: RedirectService, 25 private redirectService: RedirectService,
25 private i18n: I18n 26 private i18n: I18n
26 ) { 27 ) {
@@ -31,6 +32,10 @@ export class SignupComponent extends FormReactive implements OnInit {
31 return window.location.host 32 return window.location.host
32 } 33 }
33 34
35 get requiresEmailVerification () {
36 return this.serverService.getConfig().signup.requiresEmailVerification
37 }
38
34 ngOnInit () { 39 ngOnInit () {
35 this.buildForm({ 40 this.buildForm({
36 username: this.userValidatorsService.USER_USERNAME, 41 username: this.userValidatorsService.USER_USERNAME,
@@ -47,10 +52,17 @@ export class SignupComponent extends FormReactive implements OnInit {
47 52
48 this.userService.signup(userCreate).subscribe( 53 this.userService.signup(userCreate).subscribe(
49 () => { 54 () => {
50 this.notificationsService.success( 55 if (this.requiresEmailVerification) {
51 this.i18n('Success'), 56 this.notificationsService.alert(
52 this.i18n('Registration for {{username}} complete.', { username: userCreate.username }) 57 this.i18n('Welcome'),
53 ) 58 this.i18n('Please check your email to verify your account and complete signup.')
59 )
60 } else {
61 this.notificationsService.success(
62 this.i18n('Success'),
63 this.i18n('Registration for {{username}} complete.', { username: userCreate.username })
64 )
65 }
54 this.redirectService.redirectToHomepage() 66 this.redirectService.redirectToHomepage()
55 }, 67 },
56 68