<commit_before>/** @jsx React.DOM */
/**
 * Copyright (c) 2014, Tidepool Project
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the associated License, which is identical to the BSD 2-Clause
 * License as published by the Open Source Initiative at opensource.org.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the License for more details.
 *
 * You should have received a copy of the License along with this program; if
 * not, you can obtain one from Tidepool Project at tidepool.org.
 */

var React = require('react');
var _ = require('lodash');

var config = require('../../config');

var LoginNav = require('../../components/loginnav');
var LoginLogo = require('../../components/loginlogo');
var SimpleForm = require('../../components/simpleform');

var Login = React.createClass({
  propTypes: {
    onSubmit: React.PropTypes.func.isRequired,
    inviteEmail: React.PropTypes.string,
    onSubmitSuccess: React.PropTypes.func.isRequired,
    onSubmitNotAuthorized: React.PropTypes.func.isRequired,
    trackMetric: React.PropTypes.func.isRequired
  },

  formInputs: function() {
    return [
      {name: 'username', label: 'Email', type: 'email', disabled: !!this.props.inviteEmail},
      {name: 'password', label: 'Password', type: 'password'},
      {name: 'remember', label: 'Remember me', type: 'checkbox'}
    ];
  },

  getInitialState: function() {
    var formValues = {};

    if (this.props.inviteEmail) {
      formValues.username = this.props.inviteEmail;
    }

    return {
      working: false,
      formValues: formValues,
      validationErrors: {},
      notification: null
    };
  },

  render: function() {
    var form = this.renderForm();
    var forgotPassword = this.renderForgotPassword();
    var inviteIntro = this.renderInviteIntroduction();

    /* jshint ignore:start */
    return (
      <div className="login">
        <LoginNav
          page="login"
          hideLinks={Boolean(this.props.inviteEmail)}
          trackMetric={this.props.trackMetric} /><commit_msg>adjust login to cater to invite and signup emails<commit_after>/** @jsx React.DOM */
/**
 * Copyright (c) 2014, Tidepool Project
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the associated License, which is identical to the BSD 2-Clause
 * License as published by the Open Source Initiative at opensource.org.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the License for more details.
 *
 * You should have received a copy of the License along with this program; if
 * not, you can obtain one from Tidepool Project at tidepool.org.
 */

var React = require('react');
var _ = require('lodash');

var config = require('../../config');

var LoginNav = require('../../components/loginnav');
var LoginLogo = require('../../components/loginlogo');
var SimpleForm = require('../../components/simpleform');

var Login = React.createClass({
  propTypes: {
    onSubmit: React.PropTypes.func.isRequired,
    inviteEmail: React.PropTypes.string,
    signupEmail: React.PropTypes.string,
    onSubmitSuccess: React.PropTypes.func.isRequired,
    onSubmitNotAuthorized: React.PropTypes.func.isRequired,
    trackMetric: React.PropTypes.func.isRequired
  },

  formInputs: function() {
    return [
      {name: 'username', label: 'Email', type: 'email', disabled: !!this.state.email},
      {name: 'password', label: 'Password', type: 'password'},
      {name: 'remember', label: 'Remember me', type: 'checkbox'}
    ];
  },

  getInitialState: function() {
    var formValues = {};
    var email = this.props.signupEmail || this.props.inviteEmail;

    if (email) {
      formValues.username = email;
    }

    return {
      working: false,
      email: email,
      formValues: formValues,
      validationErrors: {},
      notification: null
    };
  },

  render: function() {
    var form = this.renderForm();
    var forgotPassword = this.renderForgotPassword();
    var inviteIntro = this.renderInviteIntroduction();

    /* jshint ignore:start */
    return (
      <div className="login">
        <LoginNav
          page="login"
          hideLinks={Boolean(this.state.email)}
          trackMetric={this.props.trackMetric} />
{'fraction_non_alphanumeric': 0.12321232123212321, 'fraction_numerical': 0.0022002200220022, 'mean_word_length': 3.3171889838556505, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4976704', 'n_tokens_mistral': 1278, 'n_tokens_neox': 1250, 'n_words': 404}