1 import { Component, OnInit } from '@angular/core'
2 import { SignupService } from '@app/+signup/shared/signup.service'
3 import { Notifier, RedirectService, ServerService } from '@app/core'
4 import { USER_EMAIL_VALIDATOR } from '@app/shared/form-validators/user-validators'
5 import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'
8 selector: 'my-verify-account-ask-send-email',
9 templateUrl: './verify-account-ask-send-email.component.html',
10 styleUrls: [ './verify-account-ask-send-email.component.scss' ]
13 export class VerifyAccountAskSendEmailComponent extends FormReactive implements OnInit {
14 requiresEmailVerification = false
17 protected formReactiveService: FormReactiveService,
18 private signupService: SignupService,
19 private serverService: ServerService,
20 private notifier: Notifier,
21 private redirectService: RedirectService
27 this.serverService.getConfig()
28 .subscribe(config => this.requiresEmailVerification = config.signup.requiresEmailVerification)
31 'verify-email-email': USER_EMAIL_VALIDATOR
35 askSendVerifyEmail () {
36 const email = this.form.value['verify-email-email']
37 this.signupService.askSendVerifyEmail(email)
40 this.notifier.success($localize`An email with verification link will be sent to ${email}.`)
41 this.redirectService.redirectToHomepage()
44 error: err => this.notifier.error(err.message)