improve authentication

This commit is contained in:
Sebastian Sdorra
2018-07-11 21:01:29 +02:00
parent 1b6df5ee08
commit b604d613a3
16 changed files with 359 additions and 110 deletions

View File

@@ -6,6 +6,7 @@ type Props = {
label?: string,
placeholder?: string,
type?: string,
autofocus?: boolean,
onChange: string => void
};
@@ -15,6 +16,14 @@ class InputField extends React.Component<Props> {
placeholder: ""
};
field: ?HTMLInputElement;
componentDidMount() {
if (this.props.autofocus && this.field) {
this.field.focus();
}
}
handleInput = (event: SyntheticInputEvent<HTMLInputElement>) => {
this.props.onChange(event.target.value);
};
@@ -35,6 +44,9 @@ class InputField extends React.Component<Props> {
{this.renderLabel()}
<div className="control">
<input
ref={input => {
this.field = input;
}}
className="input"
type={type}
placeholder={placeholder}