1 import { Component, OnInit } from '@angular/core'
2 import { ActivatedRoute } from '@angular/router'
3 import { AuthService, Notifier, UserService } from '@app/core'
4 import { I18n } from '@ngx-translate/i18n-polyfill'
7 selector: 'my-verify-account-email',
8 templateUrl: './verify-account-email.component.html'
11 export class VerifyAccountEmailComponent implements OnInit {
14 isPendingEmail = false
16 private userId: number
17 private verificationString: string
20 private userService: UserService,
21 private authService: AuthService,
22 private notifier: Notifier,
23 private route: ActivatedRoute,
29 const queryParams = this.route.snapshot.queryParams
30 this.userId = queryParams['userId']
31 this.verificationString = queryParams['verificationString']
32 this.isPendingEmail = queryParams['isPendingEmail'] === 'true'
34 if (!this.userId || !this.verificationString) {
35 this.notifier.error(this.i18n('Unable to find user id or verification string.'))
42 this.userService.verifyEmail(this.userId, this.verificationString, this.isPendingEmail)
45 if (this.authService.isLoggedIn()) {
46 this.authService.refreshUserInformation()
55 this.notifier.error(err.message)