render()

in client/src/components/Auth/Login.js [67:119]


  render() {
    const { error, loading, username, password, loggedIn, notice } = this.props;

    if (loggedIn) {
      const { from } = this.props.location.state || { from: { pathname: '/app' } };
      return (
        <Redirect to={from} />
      );
    }

    return (
      <Container style={styles.container}>
        <Header as="h1">Login</Header>
        <Message
          info
          header={notice}
          hidden={notice === ''}
        />
        <Message
          warning
          header={error}
          hidden={error === ''}
        />
        <Form loading={loading}>
          <Form.Field>
            <Form.Input
              label="Username"
              placeholder="username"
              name="username"
              value={username}
              onChange={this.handleChange}
            />
          </Form.Field>
          <Form.Field>
            <Form.Input
              label="Password"
              placeholder="password"
              type="password"
              name="password"
              value={password}
              onChange={this.handleChange}
            />
          </Form.Field>
          <Segment padded>
            <Button color="teal" fluid type="submit" onClick={this.handleSubmit}>Login</Button>
            <Divider horizontal>Or</Divider>
            <Link to="/register"><Button secondary fluid>Sign Up Now</Button></Link>
            <SocialLogins showFacebook showGoogle />
          </Segment>
        </Form>
      </Container>
    );
  }