52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
|
|
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
|
|
|
@Component({
|
|
selector: 'of-member-modify-password',
|
|
templateUrl: './member-modify-password.component.html',
|
|
})
|
|
export class MemberModifyPasswordComponent implements OnInit {
|
|
@Input() token: string;
|
|
@Output() resetPassword = new EventEmitter<{token: string, password: string, confirmPassword: string}>();
|
|
@Output() signin = new EventEmitter();
|
|
|
|
modifyPasswordForm: FormGroup;
|
|
formErrors = {
|
|
'pw': '',
|
|
'confirmPw': ''
|
|
};
|
|
|
|
constructor(
|
|
private formBuilder: FormBuilder,
|
|
) { }
|
|
|
|
ngOnInit() {
|
|
this.initForm();
|
|
}
|
|
|
|
initForm() {
|
|
this.modifyPasswordForm = this.formBuilder.group({
|
|
'pw': [
|
|
'',
|
|
[
|
|
// Validators.required,
|
|
]
|
|
],
|
|
'confirmPw': [
|
|
'',
|
|
[
|
|
// Validators.pattern('^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$'),
|
|
// Validators.minLength(6),
|
|
// Validators.maxLength(25)
|
|
]
|
|
],
|
|
});
|
|
|
|
}
|
|
|
|
modifyPasswordFormSubmit() {
|
|
const formValue = Object.assign({}, this.modifyPasswordForm.value);
|
|
this.resetPassword.emit({token: this.token, password: formValue.pw, confirmPassword: formValue.confirmPw});
|
|
}
|
|
}
|