Skip to content

Commit

Permalink
🎨 Added input password type
Browse files Browse the repository at this point in the history
Added type=password to input and enclosed in a form that will submit on enter, and allow autocomplete, password extensions, etc.
  • Loading branch information
abgeorge7 committed Feb 27, 2020
1 parent 5a01ff8 commit de6eda5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
5 changes: 5 additions & 0 deletions src/components/Login.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
border-radius: 10px;
}

.login__content form {
display: flex;
flex-flow: column;
}

.login .ui.input {
margin: 10px 0;
}
Expand Down
26 changes: 16 additions & 10 deletions src/components/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class Login extends React.Component {
this.setState({password: e.target.value});
};

login = () => {
login = e => {
e.preventDefault();
this.props.setUser(this.state.username, this.state.password);
};

Expand All @@ -29,15 +30,20 @@ class Login extends React.Component {
<div className="login">
<div className="login__content">
<h2>Login</h2>
<Input
placeholder="Enter your username"
onBlur={this.handleUsernameChange}
/>
<Input
placeholder="Enter your password"
onBlur={this.handlePasswordChange}
/>
<Button onClick={() => this.login()}>Login</Button>
<form onSubmit={this.login}>
<Input
placeholder="Enter your username"
onChange={this.handleUsernameChange}
autoComplete="username"
/>
<Input
type="password"
placeholder="Enter your password"
onChange={this.handlePasswordChange}
autoComplete="current-password"
/>
<Button type="submit">Login</Button>
</form>
</div>
</div>
);
Expand Down

0 comments on commit de6eda5

Please sign in to comment.