<commit_before>import React from 'react'
import { Link } from 'react-router'
import { connect } from 'react-redux'
import $ from 'jquery'
import _ from 'lodash'
import * as actions from './actions'

class Signin extends React.Component {

  render() {
    const { mode, show, team, user } = this.props
    return (
      <div className={`chrome-signin chrome-signin-${mode}`}>
        <div className="chrome-signin-canvas">
          <div className="chrome-signin-header">
            <h1>Sign in To Your Team</h1>
          </div>
          <div className="chrome-signin-form">
            <form className="ui form" onSubmit={this._handleTeam.bind(this)}>
              <div className="field team-field">
                <div className="ui left icon input">
                  <i className="users icon"></i>
                  <input className="form-control" autoComplete="off" placeholder="team" type="text" ref="team" />
                  <div className="suffix">.mycce.com</div>
                </div>
              </div>
              <div className="field button-field">
                <button className={`ui fluid large ${(status == 'submitting') ? 'loading' : ''} button`}>Continue <i className="right chevron icon" /></button>
              </div>
            </form>
          </div>
          <div className="chrome-signin-footer">
            { team && <p><Link to={{ pathname: '/admin', state: 'slide-back' }}>Back to { team.title }</Link></p> }
          </div>
        </div>
        <div className="chrome-signin-canvas">
          <div className="chrome-signin-header">
            { team && <img src={ team.logo } className="logo" /> }
            { team && <h1>{ team.title }</h1> }
          </div>
          <div className="chrome-signin-form">
            <form className="ui form" onSubmit={this._handleEmail.bind(this)}>
              <div className="field email-field">
                <div className="ui left icon input">
                  <i className="user icon"></i>
                  <input className="form-control" autoComplete="off" placeholder="Email" type="email" ref="email" />
                </div>
              </div>
              <div className="field button-field">
                <button className={`ui fluid large ${(status == 'submitting') ? 'loading' : ''} button`}>Continue <i className="right chevron icon" /></button>
              </div>
            </form>
          </div>
          <div className="chrome-signin-footer">
            <p><Link to={{ pathname: '/admin/signin', state: 'slide-back' }}>Wrong team?</Link></p>
            { team && _.includes(team.strategies, 'cornell') && <p><a href="/admin/signin/cornell">Signin with CUWebAuth</a></p> }
            { team && _.includes(team.strategies, 'google') && <p><a href="/admin/signin/google">Signin with Google</a></p> }
          </div>
        </div>
        <div className="chrome-signin-canvas">
          <div className="chrome-signin-header">
            { user && <img src={ user.photo } className="photo" /> }
            { user && <h1>{ user.full_name }</h1> }
            { user && <h4>{ user.email }</h4> }
          </div>
          <div className="chrome-signin-form">
            <form className="ui form" onSubmit={this._handlePassword.bind(this)}>
              <div className="field password-field">
                <div className="ui left icon input">
                  <i className="lock icon"></i>
                  <input className="form-control" autoComplete="off" placeholder="Password" type={ show ? 'text' : 'password' } ref="password" />
                  <a onClick={ this._handleTogglePassword.bind(this) }>{ show ? 'HIDE' : 'SHOW' }</a>
                </div>
              </div>
              <div className="field button-field">
                <button className={`ui fluid large ${(status == 'submitting') ? 'loading' : ''} button`}>Signin</button>
              </div>
            </form>
          </div>
          <div className="chrome-signin-footer">
            <p><Link to={{ pathname: '/admin/signin/email', state: 'slide-back' }}>Not you?</Link></p>
            <p><a onClick={ this._handleForgot.bind(this) }>Forgot your password?</a></p>
          </div>
        </div>
      </div>
    )
  }

  _handleTeam(e) {
    $(this.refs.subdomain).click().focus()
    const { teams, onTeam } = this.props
    const subdomain = $(this.refs.team).val()
    const index = _.findIndex(teams, { subdomain })
    if(index >= 0) {
      this.context.admin.chooseTeam(index)
      this.context.router.push({ pathname: '/admin', state: 'fade' })
    } else {
      onTeam(subdomain)
      $(this.refs.email).click().focus()
    }
    e.preventDefault()
    return false
  }

  _handleEmail(e) {
    const { team, onEmail } = this.props
    const email = $(this.refs.email).val()
    onEmail(team.id, email)
    $(this.refs.password).click().focus()
    e.preventDefault()
    return false
  }

  _handlePassword(e) {
    const { team, user, onPassword } = this.props
    const password = $(this.refs.password).val()
    onPassword(team.id, user.email, password)
    e.preventDefault()
    return false
  }

  _handleTogglePassword() {
    this.props.onTogglePassword()
    $(this.refs.password).click().focus()
  }

  _handleForgot() {
    const { team, user, onForgot } = this.props
    onForgot(team.id, user.email)
  }
<commit_msg>refocus input field<commit_after>import React from 'react'
import { Link } from 'react-router'
import { connect } from 'react-redux'
import $ from 'jquery'
import _ from 'lodash'
import * as actions from './actions'

class Signin extends React.Component {

  render() {
    const { mode, show, status, team, user } = this.props
    return (
      <div className={`chrome-signin chrome-signin-${mode}`}>
        <div className="chrome-signin-canvas">
          <div className="chrome-signin-header">
            <h1>Sign in To Your Team</h1>
          </div>
          <div className="chrome-signin-form">
            <form className="ui form" onSubmit={this._handleTeam.bind(this)}>
              <div className="field team-field">
                <div className="ui left icon input">
                  <i className="users icon"></i>
                  <input className="form-control" autoComplete="off" placeholder="team" type="text" ref="team" />
                  <div className="suffix">.mycce.com</div>
                </div>
              </div>
              <div className="field button-field">
                <button className={`ui fluid large ${(status === 'submitting') ? 'loading' : ''} button`}>Continue <i className="right chevron icon" /></button>
              </div>
            </form>
          </div>
          <div className="chrome-signin-footer">
            { team && <p><Link to={{ pathname: '/admin', state: 'slide-back' }}>Back to { team.title }</Link></p> }
          </div>
        </div>
        <div className="chrome-signin-canvas">
          <div className="chrome-signin-header">
            { team && <img src={ team.logo } className="logo" /> }
            { team && <h1>{ team.title }</h1> }
          </div>
          <div className="chrome-signin-form">
            <form className="ui form" onSubmit={this._handleEmail.bind(this)}>
              <div className="field email-field">
                <div className="ui left icon input">
                  <i className="user icon"></i>
                  <input className="form-control" autoComplete="off" placeholder="Email" type="email" ref="email" />
                </div>
              </div>
              <div className="field button-field">
                <button className={`ui fluid large ${(status === 'submitting') ? 'loading' : ''} button`}>Continue <i className="right chevron icon" /></button>
              </div>
            </form>
          </div>
          <div className="chrome-signin-footer">
            <p><Link to={{ pathname: '/admin/signin', state: 'slide-back' }}>Wrong team?</Link></p>
            { team && _.includes(team.strategies, 'cornell') && <p><a href="/admin/signin/cornell">Signin with CUWebAuth</a></p> }
            { team && _.includes(team.strategies, 'google') && <p><a href="/admin/signin/google">Signin with Google</a></p> }
          </div>
        </div>
        <div className="chrome-signin-canvas">
          <div className="chrome-signin-header">
            { user && <img src={ user.photo } className="photo" /> }
            { user && <h1>{ user.full_name }</h1> }
            { user && <h4>{ user.email }</h4> }
          </div>
          <div className="chrome-signin-form">
            <form className="ui form" onSubmit={this._handlePassword.bind(this)}>
              <div className="field password-field">
                <div className="ui left icon input">
                  <i className="lock icon"></i>
                  <input className="form-control" autoComplete="off" placeholder="Password" type={ show ? 'text' : 'password' } ref="password" />
                  <a onClick={ this._handleTogglePassword.bind(this) }>{ show ? 'HIDE' : 'SHOW' }</a>
                </div>
              </div>
              <div className="field button-field">
                <button className={`ui fluid large ${(status === 'submitting') ? 'loading' : ''} button`}>Signin</button>
              </div>
            </form>
          </div>
          <div className="chrome-signin-footer">
            <p><Link to={{ pathname: '/admin/signin/email', state: 'slide-back' }}>Not you?</Link></p>
            <p><a onClick={ this._handleForgot.bind(this) }>Forgot your password?</a></p>
          </div>
        </div>
      </div>
    )
  }

  _handleTeam(e) {
    $(this.refs.subdomain).click().focus()
    const { teams, onTeam } = this.props
    const subdomain = $(this.refs.team).val()
    const index = _.findIndex(teams, { subdomain })
    if(index >= 0) {
      this.context.admin.chooseTeam(index)
      this.context.router.push({ pathname: '/admin', state: 'fade' })
    } else {
      onTeam(subdomain)
      $(this.refs.email).click().focus()
    }
    e.preventDefault()
    return false
  }

  _handleEmail(e) {
    const { team, onEmail } = this.props
    const email = $(this.refs.email).val()
    onEmail(team.id, email)
    $(this.refs.password).click().focus()
    e.preventDefault()
    return false
  }

  _handlePassword(e) {
    const { team, user, onPassword } = this.props
    const password = $(this.refs.password).val()
    onPassword(team.id, user.email, password)
    $(this.refs.password).click().focus()
    e.preventDefault()
    return false
  }

  _handleTogglePassword() {
    this.props.onTogglePassword()
    $(this.refs.password).click().focus()
  }

  _handleForgot() {
    const { team, user, onForgot } = this.props
    onForgot(team.id, user.email)
  }

{'fraction_non_alphanumeric': 0.16986022401184855, 'fraction_numerical': 0.0016662038322688142, 'mean_word_length': 2.1581408944752996, 'pattern_counts': {'":': 0, '<': 213, '<?xml version=': 0, '>': 215, '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': '1200200', 'n_tokens_mistral': 3248, 'n_tokens_neox': 3158, 'n_words': 696}