Commit 10737080 authored by Emily Jensen's avatar Emily Jensen

Adds focus to password input on init

parent 4fe0791c
......@@ -11,6 +11,7 @@
<div class="form-field form-field--large">
<label for="oldPassword" class="form-field__label">Current Password</label>
<input
#passwordInput
type="password"
[ngrxFormControlState]="form.controls.oldPassword"
class="form-field__input form-field__input--one-action"
......
......@@ -4,7 +4,9 @@ import {
Output,
ChangeDetectionStrategy,
EventEmitter,
OnInit
OnInit,
ViewChild,
ElementRef
} from "@angular/core";
import { FormGroupState } from "ngrx-forms";
import { IForm } from "./manage-backup-code.reducer";
......@@ -36,6 +38,9 @@ export class ManageBackupCodeComponent implements OnInit {
@Output()
reset = new EventEmitter();
@ViewChild("passwordInput")
passwordInput: ElementRef;
onSubmit() {
if (this.form.isValid) {
this.newBackupCode.emit();
......@@ -48,8 +53,11 @@ export class ManageBackupCodeComponent implements OnInit {
ngOnInit() {
this.reset.emit();
this.passwordInput.nativeElement.focus();
}
constructor() {}
}
......@@ -79,7 +79,11 @@ export function reducer(state = initialState,
hasStarted: false,
newBackupCode: null
};
case ManageBackupCodeActionTypes.RESET_FORM:
return initialState;
}
return state;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment