import React from 'react';
import { connect } from 'react-redux';
import 
import { addFlashMessage } from '../actions/flashMessages';

export default function(ComposedComponent) {
  class Authenticate extends React.Component {
    componentWillMount() {
      if (!this.props.isAuthenticated) {
        this.props.addFlashMessage({
          type: 'error',
          text: 'You need to login to access this page'
        });
        this.context.router.push('/login');
      }
    }

    componentWillUpdate(nextProps) {
      if (!nextProps.isAuthenticated) {
        this.context.router.push('/');
      }
    }

    render() {
      return (
        <ComposedComponent {...this.props} />
      );
    }
  }

  Authenticate.propTypes = {
    isAuthenticated: React.PropTypes.bool.isRequired,
    addFlashMessage: React.PropTypes.func.isRequired
  };

  Authenticate.contextTypes = {
    router: React.PropTypes.object.isRequired
  };

  function mapStateToProps(state) {
    return {
      isAuthenticated: state.auth.isAuthenticated
    };
  }

  return connect(mapStateToProps, { addFlashMessage })(Authenticate);
}

@@ -70,69 +70,111 @@
 ort 
-%0Aimport %7B addFlashMessage %7D from '../actions/flashMessages';%0A
+toastr from 'toastr';%0A%0A/**%0A *%0A *%0A * @export%0A * @param %7BObject%7D ComposedComponent%0A * @returns %7Bvoid%7D%0A */
 %0Aexp
@@ -193,16 +193,17 @@
 function
+ 
 (Compose
@@ -222,52 +222,221 @@
 %7B%0A  
-class Authenticate extends React.Component %7B
+/**%0A   *%0A   *%0A   * @class Authenticate%0A   * @extends %7BReact.Component%7D%0A   */%0A  class Authenticate extends React.Component %7B%0A    /**%0A     *%0A     *%0A     *%0A     * @memberof Authenticate%0A     * @returns %7Bvoid%7D%0A     */
 %0A   
@@ -513,78 +513,28 @@
    t
-his.props.addFlashMessage(%7B%0A          type: 'error',%0A          text
+oastr.error('Error
 : 
-'
 You 
@@ -571,18 +571,8 @@
 age'
-%0A        %7D
 );%0A 
@@ -625,24 +625,140 @@
    %7D%0A    %7D%0A%0A
+    /**%0A     *%0A     *%0A     * @param %7BObject%7D nextProps%0A     * @returns %7Bvoid%7D%0A     * @memberof Authenticate%0A     */%0A
     componen
@@ -872,24 +872,114 @@
    %7D%0A    %7D%0A%0A
+    /**%0A     *%0A     *%0A     * @returns %7Bvoid%7D%0A     *%0A     * @memberof Authenticate%0A     */%0A
     render()
@@ -1147,62 +1147,8 @@
 ired
-,%0A    addFlashMessage: React.PropTypes.func.isRequired
 %0A  %7D
@@ -1234,16 +1234,118 @@
 d%0A  %7D;%0A%0A
+  /**%0A   *%0A   *%0A   * @param %7Bany%7D state%0A   * @returns %7Bobject%7D containing authentication status%0A   */%0A
   functi

fix linting [#146514255]