blob: a0ed66a3a1bb193bb7e511eb1f461c37422a400d (
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
|
import { Component, OnInit } from '@angular/core'
import { Notifier, RedirectService, ServerService } from '@app/core'
import { USER_EMAIL_VALIDATOR } from '@app/shared/form-validators/user-validators'
import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
import { UserSignupService } from '@app/shared/shared-users'
@Component({
selector: 'my-verify-account-ask-send-email',
templateUrl: './verify-account-ask-send-email.component.html',
styleUrls: [ './verify-account-ask-send-email.component.scss' ]
})
export class VerifyAccountAskSendEmailComponent extends FormReactive implements OnInit {
requiresEmailVerification = false
constructor (
protected formValidatorService: FormValidatorService,
private userSignupService: UserSignupService,
private serverService: ServerService,
private notifier: Notifier,
private redirectService: RedirectService
) {
super()
}
ngOnInit () {
this.serverService.getConfig()
.subscribe(config => this.requiresEmailVerification = config.signup.requiresEmailVerification)
this.buildForm({
'verify-email-email': USER_EMAIL_VALIDATOR
})
}
askSendVerifyEmail () {
const email = this.form.value['verify-email-email']
this.userSignupService.askSendVerifyEmail(email)
.subscribe({
next: () => {
this.notifier.success($localize`An email with verification link will be sent to ${email}.`)
this.redirectService.redirectToHomepage()
},
error: err => this.notifier.error(err.message)
})
}
}
|