blob: 88efce4a1b75a56cea606681d30c03f8decf1dd6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
import { Component, OnInit } from '@angular/core'
import { ActivatedRoute } from '@angular/router'
import { AuthService, Notifier } from '@app/core'
import { UserSignupService } from '@app/shared/shared-users'
@Component({
selector: 'my-verify-account-email',
templateUrl: './verify-account-email.component.html'
})
export class VerifyAccountEmailComponent implements OnInit {
success = false
failed = false
isPendingEmail = false
private userId: number
private verificationString: string
constructor (
private userSignupService: UserSignupService,
private authService: AuthService,
private notifier: Notifier,
private route: ActivatedRoute
) {
}
ngOnInit () {
const queryParams = this.route.snapshot.queryParams
this.userId = queryParams['userId']
this.verificationString = queryParams['verificationString']
this.isPendingEmail = queryParams['isPendingEmail'] === 'true'
if (!this.userId || !this.verificationString) {
this.notifier.error($localize`Unable to find user id or verification string.`)
} else {
this.verifyEmail()
}
}
verifyEmail () {
this.userSignupService.verifyEmail(this.userId, this.verificationString, this.isPendingEmail)
.subscribe({
next: () => {
if (this.authService.isLoggedIn()) {
this.authService.refreshUserInformation()
}
this.success = true
},
error: err => {
this.failed = true
this.notifier.error(err.message)
}
})
}
}
|