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'
5 import { ServerConfig } from '@shared/models'
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 private serverConfig: ServerConfig
17 protected formValidatorService: FormValidatorService,
18 private userService: UserService,
19 private serverService: ServerService,
20 private notifier: Notifier,
21 private redirectService: RedirectService
26 get requiresEmailVerification () {
27 return this.serverConfig.signup.requiresEmailVerification
31 this.serverConfig = this.serverService.getTmpConfig()
32 this.serverService.getConfig()
33 .subscribe(config => this.serverConfig = config)
36 'verify-email-email': USER_EMAIL_VALIDATOR
40 askSendVerifyEmail () {
41 const email = this.form.value['verify-email-email']
42 this.userService.askSendVerifyEmail(email)
45 this.notifier.success($localize`An email with verification link will be sent to ${email}.`)
46 this.redirectService.redirectToHomepage()
50 this.notifier.error(err.message)