diff options
Diffstat (limited to 'client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts')
-rw-r--r-- | client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts b/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts index 3fb2d1cd8..054f04310 100644 --- a/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts +++ b/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | 3 | import { I18n } from '@ngx-translate/i18n-polyfill' |
4 | import { Notifier } from '@app/core' | 4 | import { AuthService, Notifier } from '@app/core' |
5 | import { UserService } from '@app/shared' | 5 | import { UserService } from '@app/shared' |
6 | 6 | ||
7 | @Component({ | 7 | @Component({ |
@@ -11,12 +11,15 @@ import { UserService } from '@app/shared' | |||
11 | 11 | ||
12 | export class VerifyAccountEmailComponent implements OnInit { | 12 | export class VerifyAccountEmailComponent implements OnInit { |
13 | success = false | 13 | success = false |
14 | failed = false | ||
15 | isPendingEmail = false | ||
14 | 16 | ||
15 | private userId: number | 17 | private userId: number |
16 | private verificationString: string | 18 | private verificationString: string |
17 | 19 | ||
18 | constructor ( | 20 | constructor ( |
19 | private userService: UserService, | 21 | private userService: UserService, |
22 | private authService: AuthService, | ||
20 | private notifier: Notifier, | 23 | private notifier: Notifier, |
21 | private router: Router, | 24 | private router: Router, |
22 | private route: ActivatedRoute, | 25 | private route: ActivatedRoute, |
@@ -25,8 +28,12 @@ export class VerifyAccountEmailComponent implements OnInit { | |||
25 | } | 28 | } |
26 | 29 | ||
27 | ngOnInit () { | 30 | ngOnInit () { |
28 | this.userId = this.route.snapshot.queryParams['userId'] | 31 | const queryParams = this.route.snapshot.queryParams |
29 | this.verificationString = this.route.snapshot.queryParams['verificationString'] | 32 | this.userId = queryParams['userId'] |
33 | this.verificationString = queryParams['verificationString'] | ||
34 | this.isPendingEmail = queryParams['isPendingEmail'] === 'true' | ||
35 | |||
36 | console.log(this.isPendingEmail) | ||
30 | 37 | ||
31 | if (!this.userId || !this.verificationString) { | 38 | if (!this.userId || !this.verificationString) { |
32 | this.notifier.error(this.i18n('Unable to find user id or verification string.')) | 39 | this.notifier.error(this.i18n('Unable to find user id or verification string.')) |
@@ -36,13 +43,17 @@ export class VerifyAccountEmailComponent implements OnInit { | |||
36 | } | 43 | } |
37 | 44 | ||
38 | verifyEmail () { | 45 | verifyEmail () { |
39 | this.userService.verifyEmail(this.userId, this.verificationString) | 46 | this.userService.verifyEmail(this.userId, this.verificationString, this.isPendingEmail) |
40 | .subscribe( | 47 | .subscribe( |
41 | () => { | 48 | () => { |
49 | this.authService.refreshUserInformation() | ||
50 | |||
42 | this.success = true | 51 | this.success = true |
43 | }, | 52 | }, |
44 | 53 | ||
45 | err => { | 54 | err => { |
55 | this.failed = true | ||
56 | |||
46 | this.notifier.error(err.message) | 57 | this.notifier.error(err.message) |
47 | } | 58 | } |
48 | ) | 59 | ) |