import { Component, OnInit } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
-import { USER_PASSWORD, UserService } from '@app/shared'
-import { NotificationsService } from 'angular2-notifications'
-import { AuthService } from '../core'
-import { FormReactive } from '../shared'
+import { UserService, UserValidatorsService, FormReactive } from '@app/shared'
+import { Notifier } from '@app/core'
import { I18n } from '@ngx-translate/i18n-polyfill'
-import { RESET_PASSWORD_CONFIRM } from '@app/shared/forms/form-validators/reset-password'
import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
+import { ResetPasswordValidatorsService } from '@app/shared/forms/form-validators/reset-password-validators.service'
@Component({
selector: 'my-login',
constructor (
protected formValidatorService: FormValidatorService,
- private authService: AuthService,
+ private resetPasswordValidatorsService: ResetPasswordValidatorsService,
+ private userValidatorsService: UserValidatorsService,
private userService: UserService,
- private notificationsService: NotificationsService,
+ private notifier: Notifier,
private router: Router,
private route: ActivatedRoute,
private i18n: I18n
ngOnInit () {
this.buildForm({
- password: USER_PASSWORD,
- 'password-confirm': RESET_PASSWORD_CONFIRM
+ password: this.userValidatorsService.USER_PASSWORD,
+ 'password-confirm': this.resetPasswordValidatorsService.RESET_PASSWORD_CONFIRM
})
this.userId = this.route.snapshot.queryParams['userId']
this.verificationString = this.route.snapshot.queryParams['verificationString']
if (!this.userId || !this.verificationString) {
- this.notificationsService.error(this.i18n('Error'), this.i18n('Unable to find user id or verification string.'))
+ this.notifier.error(this.i18n('Unable to find user id or verification string.'))
this.router.navigate([ '/' ])
}
}
this.userService.resetPassword(this.userId, this.verificationString, this.form.value.password)
.subscribe(
() => {
- this.notificationsService.success(this.i18n('Success'), this.i18n('Your password has been successfully reset!'))
+ this.notifier.success(this.i18n('Your password has been successfully reset!'))
this.router.navigate([ '/login' ])
},
- err => this.notificationsService.error('Error', err.message)
+ err => this.notifier.error(err.message)
)
}