member_webapp/@overflow/member/component/member-reset-password.component.ts
2018-05-30 16:44:21 +09:00

59 lines
1.2 KiB
TypeScript

import {
Component,
OnInit,
Output,
EventEmitter, Input
} from '@angular/core';
import {
FormGroup,
FormBuilder,
Validators,
AbstractControl
} from '@angular/forms';
import {Member} from '@overflow/commons-typescript/model/member';
@Component({
selector: 'of-member-reset-password',
templateUrl: './member-reset-password.component.html',
})
export class MemberResetPasswordComponent implements OnInit {
@Output() resetPassword = new EventEmitter<string>();
@Output() signin = new EventEmitter();
@Output() signup = new EventEmitter();
@Input() member: Member;
resetPasswordForm: FormGroup;
email: AbstractControl;
constructor(
private formBuilder: FormBuilder
) {
}
ngOnInit() {
this.resetPasswordForm = this.formBuilder.group({
'email': ['', [
Validators.required,
Validators.email
]
]
});
this.email = this.resetPasswordForm.controls['email'];
}
resetPasswordSubmit() {
const formValue = Object.assign({}, this.resetPasswordForm.value);
this.resetPassword.emit(formValue.email);
}
onSignin() {
this.signin.emit();
}
onSignup() {
this.signup.emit();
}
}