ForgotPane.js 2.88 KB
import React                              from 'react';
import { Link }                           from 'react-router';
import { ActionButton }                   from '/imports/client/components/ActionButton';
import { setQueryParam }                  from '/imports/client/app/utils/setQueryParam';
import { Button, Form, FormGroup, Label, Input, FormText, Col } from 'reactstrap';
import { Alert }                          from 'reactstrap';
import 'velocity-animate';
import 'velocity-animate/velocity.ui';
import { VelocityComponent, VelocityTransitionGroup, velocityHelpers } from 'velocity-react';
import ReactSVG                           from 'react-svg'

export class ForgotPane extends React.Component {

  render() {
    return (
      <Col sm={{ size: 12, push: 1, pull: 1 }}>
        <VelocityTransitionGroup enter={{ animation: "transition.slideRightIn"}} leave={{animation: "transition.fadeOut" }} runOnMount={true}>
          <div className="enterPane__centerVerticallyWrapper">
            <Link
              to={ setQueryParam(this.props.location, { enter: 'login' }) }>
              <ReactSVG
                path="/files/images/svg/logo2--white.svg"
                className="enterPane__logo"
              />
            </Link>
            <div className="enterPane__box">
              <div className="enterPane__header">
                Reset your password
              </div>
              <Alert color="danger" isOpen={ this.props.data.error.length !== 0 }>
                { this.props.data.error }
              </Alert>
              <Alert color="success" isOpen={ this.props.data.message.length !== 0 }>
                { this.props.data.message }
              </Alert>
              <Form onSubmit={ (e) => this.props.onForgot(e) }>
                <FormGroup>
                  <Input type="email" size="lg"
                      value={ this.props.data.email }
                      onChange={ (e) => this.props.onUpdate('email', e.currentTarget.value) }
                      name="email"
                      id="email"
                      placeholder="Enter your email" />
                </FormGroup>
                <FormGroup>
                  <ActionButton
                    loading={ this.props.data.loading }>
                    <Button
                        color="success" size="lg"
                        type="submit"
                        block>
                      Reset password
                    </Button>
                  </ActionButton>
                </FormGroup>
                <FormGroup className="enterPane__formGroup--center">
                  <Link className="enterPane__link"
                    to={ setQueryParam(this.props.location, { enter: 'login' }) }>
                    Log In
                  </Link>
                </FormGroup>
              </Form>
            </div>
          </div>
        </VelocityTransitionGroup>
      </Col>
    );
  }
}