mirror of
https://gitlab.com/comunic/comunicconsole
synced 2024-11-27 15:59:23 +00:00
Update login form
This commit is contained in:
parent
0d581cca41
commit
e9c631e78a
@ -21,6 +21,7 @@ import {
|
|||||||
|
|
||||||
import LockOutlinedIcon from "@material-ui/icons/LockOutlined";
|
import LockOutlinedIcon from "@material-ui/icons/LockOutlined";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { matAlert } from "../widgets/DialogsProvider";
|
||||||
|
|
||||||
function Copyright() {
|
function Copyright() {
|
||||||
return (
|
return (
|
||||||
@ -33,7 +34,38 @@ function Copyright() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LoginRoute extends React.Component {
|
interface LoginRouteState {
|
||||||
|
currEmail: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class LoginRoute extends React.Component<{}, LoginRouteState> {
|
||||||
|
constructor(props: any) {
|
||||||
|
super(props);
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
currEmail: "",
|
||||||
|
};
|
||||||
|
|
||||||
|
this.handleChangedEmail = this.handleChangedEmail.bind(this);
|
||||||
|
this.handleSubmitEmail = this.handleSubmitEmail.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
get canSubmit(): boolean {
|
||||||
|
return this.state.currEmail.length > 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
handleChangedEmail(e: React.ChangeEvent<HTMLInputElement>) {
|
||||||
|
this.setState({ currEmail: e.target.value });
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSubmitEmail(e: React.ChangeEvent<any>) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
if (!this.canSubmit) return;
|
||||||
|
|
||||||
|
matAlert("good");
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -75,6 +107,7 @@ export class LoginRoute extends React.Component {
|
|||||||
marginTop: "1px",
|
marginTop: "1px",
|
||||||
}}
|
}}
|
||||||
noValidate
|
noValidate
|
||||||
|
onSubmit={this.handleSubmitEmail}
|
||||||
>
|
>
|
||||||
<TextField
|
<TextField
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
@ -83,19 +116,21 @@ export class LoginRoute extends React.Component {
|
|||||||
fullWidth
|
fullWidth
|
||||||
id="email"
|
id="email"
|
||||||
label="Email Address"
|
label="Email Address"
|
||||||
name="email"
|
value={this.state.currEmail}
|
||||||
autoComplete="email"
|
autoComplete="email"
|
||||||
|
onChange={this.handleChangedEmail}
|
||||||
autoFocus
|
autoFocus
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
onClick={this.handleSubmitEmail}
|
||||||
fullWidth
|
fullWidth
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="primary"
|
color="primary"
|
||||||
style={{
|
style={{
|
||||||
margin: "10px 0px 2px 0px",
|
margin: "10px 0px 2px 0px",
|
||||||
}}
|
}}
|
||||||
|
disabled={!this.canSubmit}
|
||||||
>
|
>
|
||||||
Sign In
|
Sign In
|
||||||
</Button>
|
</Button>
|
||||||
|
Loading…
Reference in New Issue
Block a user