import { tap } from 'rxjs/operators'
import { Component, OnInit } from '@angular/core'
import { AuthService, ServerService, UserService } from '@app/core'
-import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms'
-import { I18n } from '@ngx-translate/i18n-polyfill'
+import { USER_EMAIL_VALIDATOR, USER_PASSWORD_VALIDATOR } from '@app/shared/form-validators/user-validators'
+import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
import { User } from '@shared/models'
@Component({
constructor (
protected formValidatorService: FormValidatorService,
- private userValidatorsService: UserValidatorsService,
private authService: AuthService,
private userService: UserService,
- private serverService: ServerService,
- private i18n: I18n
+ private serverService: ServerService
) {
super()
}
ngOnInit () {
this.buildForm({
- 'new-email': this.userValidatorsService.USER_EMAIL,
- 'password': this.userValidatorsService.USER_PASSWORD
+ 'new-email': USER_EMAIL_VALIDATOR,
+ 'password': USER_PASSWORD_VALIDATOR
})
this.user = this.authService.getUser()
this.form.reset()
if (config.signup.requiresEmailVerification) {
- this.success = this.i18n('Please check your emails to verify your new email.')
+ this.success = $localize`Please check your emails to verify your new email.`
} else {
- this.success = this.i18n('Email updated.')
+ this.success = $localize`Email updated.`
}
},
err => {
if (err.status === 401) {
- this.error = this.i18n('You current password is invalid.')
+ this.error = $localize`You current password is invalid.`
return
}