1 import { Component, OnInit } from '@angular/core'
2 import { Notifier, RedirectService, ServerService, UserService } from '@app/core'
3 import { USER_EMAIL_VALIDATOR } from '@app/shared/form-validators/user-validators'
4 import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
7 selector: 'my-verify-account-ask-send-email',
8 templateUrl: './verify-account-ask-send-email.component.html',
9 styleUrls: [ './verify-account-ask-send-email.component.scss' ]
12 export class VerifyAccountAskSendEmailComponent extends FormReactive implements OnInit {
13 requiresEmailVerification = false
16 protected formValidatorService: FormValidatorService,
17 private userService: UserService,
18 private serverService: ServerService,
19 private notifier: Notifier,
20 private redirectService: RedirectService
26 this.serverService.getConfig()
27 .subscribe(config => this.requiresEmailVerification = config.signup.requiresEmailVerification)
30 'verify-email-email': USER_EMAIL_VALIDATOR
34 askSendVerifyEmail () {
35 const email = this.form.value['verify-email-email']
36 this.userService.askSendVerifyEmail(email)
39 this.notifier.success($localize`An email with verification link will be sent to ${email}.`)
40 this.redirectService.redirectToHomepage()
43 error: err => this.notifier.error(err.message)