 putFile = require '../lib/put-file'
 
 MAX_AVATAR_SIZE = 65536
+MIN_PASSWORD_LENGTH = 8
 
 ChangePasswordForm = React.createClass
   displayName: 'ChangePasswordForm'

        <tbody>
          <tr>
            <td>Current password</td>
            <td><input type="password" ref="old" className="standard-input" size="20" /></td>
          </tr>
          <tr>
            <td>New password</td>
            <td><input type="password" ref="new" className="standard-input" size="20" /></td>
          </tr>
          <tr>
            <td>Confirm new password</td>
            <td><input type="password" ref="confirmation" className="standard-input" size="20" /></td>
          </tr>
        </tbody>
      </table>

      <p>
        <button type="submit" className="standard-button" disabled={@state.inProgress}>Change</button>{' '}
        {if @state.inProgress
          <i className="fa fa-spinner fa-spin form-help"></i>
        else if @state.success

      </p>
    </form>

  tooShort: ->
    @state.new.length < MIN_PASSWORD_LENGTH

  doesntMatch: ->
    @state.new isnt @state.confirmation

  handleSubmit: (e) ->
    e.preventDefault()

    current = @state.old
    replacement = @state.new

    @setState
      inProgress: true
