<commit_before>import { Component } from 'react'
import {
  Button,
  Form,
  Segment
} from 'semantic-ui-react'
import GraphQLErrorMessage from './GraphQLErrorMessage'

class PlayerLoginPasswordForm extends Component {
  handleChange = (e, { name, value }) => this.setState({ [name]: value })

  constructor(props) {
    super(props)

    this.state =
    { email: ''
    , password: ''
    , error: null
    , loading: false
    }
  }

  onSubmit = async (e) => {
    this.setState({ loading: true })

    try {
      await this.props.onSubmit(e, this.state)
    } catch (error) {
      this.setState({ error })
    }

    this.setState({ loading: false })
  }

  render() {
    const { error, loading } = this.state

    return (
      <Form size='large' onSubmit={this.onSubmit} error loading={loading}>
        <Segment>
          <GraphQLErrorMessage error={error} />
          <Form.Input
            required
            name='email'
            placeholder='Email address'
            icon='user'
            iconPosition='left'
            onChange={this.handleChange}
          />
          <Form.Input
            required<commit_msg>Fixed login password form not displaying errors<commit_after>import { Component } from 'react'
import {
  Button,
  Form,
  Segment
} from 'semantic-ui-react'
import ErrorMessage from './ErrorMessage'

class PlayerLoginPasswordForm extends Component {
  handleChange = (e, { name, value }) => this.setState({ [name]: value })

  constructor(props) {
    super(props)

    this.state =
    { email: ''
    , password: ''
    , error: null
    , loading: false
    }
  }

  onSubmit = async (e) => {
    this.setState({ loading: true })

    try {
      await this.props.onSubmit(e, this.state)
    } catch (error) {
      this.setState({ error })
    }

    this.setState({ loading: false })
  }

  render() {
    const { error, loading } = this.state

    return (
      <Form size='large' onSubmit={this.onSubmit} error loading={loading}>
        <Segment>
          <ErrorMessage error={error} />
          <Form.Input
            required
            name='email'
            placeholder='Email address'
            icon='user'
            iconPosition='left'
            onChange={this.handleChange}
          />
          <Form.Input
            required
{'fraction_non_alphanumeric': 0.12581344902386118, 'fraction_numerical': 0.0, 'mean_word_length': 2.145975443383356, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6523895', 'n_tokens_mistral': 672, 'n_tokens_neox': 663, 'n_words': 155}