diff --git a/client/modules/App/App.jsx b/client/modules/App/App.jsx
index 5598225d..b300cde0 100644
--- a/client/modules/App/App.jsx
+++ b/client/modules/App/App.jsx
@@ -1,6 +1,7 @@
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import DevTools from './components/DevTools';
+import { setPreviousPath } from '../IDE/actions/ide';
class App extends React.Component {
constructor(props, context) {
@@ -12,6 +13,12 @@ class App extends React.Component {
this.setState({ isMounted: true }); // eslint-disable-line react/no-did-mount-set-state
}
+ componentWillReceiveProps(nextProps) {
+ if (nextProps.location !== this.props.location) {
+ this.props.setPreviousPath(this.props.location.pathname);
+ }
+ }
+
render() {
return (
@@ -23,7 +30,11 @@ class App extends React.Component {
}
App.propTypes = {
- children: PropTypes.object
+ children: PropTypes.object,
+ location: PropTypes.shape({
+ pathname: PropTypes.string
+ }),
+ setPreviousPath: PropTypes.func.isRequired,
};
-export default connect()(App);
+export default connect(() => ({}), { setPreviousPath })(App);
diff --git a/client/modules/IDE/components/LoginView.jsx b/client/modules/IDE/components/LoginView.jsx
deleted file mode 100644
index 083c51b6..00000000
--- a/client/modules/IDE/components/LoginView.jsx
+++ /dev/null
@@ -1,63 +0,0 @@
-import React from 'react';
-import { reduxForm } from 'redux-form';
-import { validateAndLoginUser } from '../../User/actions';
-import LoginForm from '../components/LoginForm';
-// import GithubButton from '../components/GithubButton';
-import { Link } from 'react-router';
-
-
-class LoginView extends React.Component {
- componentDidMount() {
- this.refs.login.focus();
- }
-
- render() {
- return (
-
-
Login
-
- {/*
Or
-
*/}
-
- Don't have an account?
- Sign Up
-
-
- Forgot your password?
- Reset your password
-
-
Cancel
-
- );
- }
-}
-
-function mapStateToProps(state, ownProps) {
- return {
- user: state.user,
- previousPath: ownProps.previousPath
- };
-}
-
-function mapDispatchToProps() {
- return {
- validateAndLoginUser
- };
-}
-
-function validate(formProps) {
- const errors = {};
- if (!formProps.email) {
- errors.email = 'Please enter an email';
- }
- if (!formProps.password) {
- errors.password = 'Please enter a password';
- }
- return errors;
-}
-
-export default reduxForm({
- form: 'login',
- fields: ['email', 'password'],
- validate
-}, mapStateToProps, mapDispatchToProps)(LoginView);
diff --git a/client/modules/IDE/pages/IDEView.jsx b/client/modules/IDE/pages/IDEView.jsx
index 2b81ad60..3ad02193 100644
--- a/client/modules/IDE/pages/IDEView.jsx
+++ b/client/modules/IDE/pages/IDEView.jsx
@@ -28,8 +28,6 @@ import SplitPane from 'react-split-pane';
import Overlay from '../../App/components/Overlay';
import SketchList from '../components/SketchList';
import About from '../components/About';
-import LoginView from '../components/LoginView';
-import SignupView from '../components/SignupView';
import ResetPasswordView from '../components/ResetPasswordView';
import NewPasswordView from '../components/NewPasswordView';
@@ -434,24 +432,6 @@ class IDEView extends React.Component {
);
}
})()}
- {(() => { // eslint-disable-line
- if (this.props.location.pathname === '/login') {
- return (
-
-
-
- );
- }
- })()}
- {(() => { // eslint-disable-line
- if (this.props.location.pathname === '/signup') {
- return (
-
-
-
- );
- }
- })()}
{(() => { // eslint-disable-line
if (this.props.location.pathname === '/reset-password') {
return (
diff --git a/client/modules/IDE/components/LoginForm.jsx b/client/modules/User/components/LoginForm.jsx
similarity index 78%
rename from client/modules/IDE/components/LoginForm.jsx
rename to client/modules/User/components/LoginForm.jsx
index 707396b1..b5a7aa67 100644
--- a/client/modules/IDE/components/LoginForm.jsx
+++ b/client/modules/User/components/LoginForm.jsx
@@ -5,27 +5,29 @@ function LoginForm(props) {
const { fields: { email, password }, handleSubmit, submitting, pristine } = props;
return (
);
}
diff --git a/client/modules/IDE/components/SignupForm.jsx b/client/modules/User/components/SignupForm.jsx
similarity index 73%
rename from client/modules/IDE/components/SignupForm.jsx
rename to client/modules/User/components/SignupForm.jsx
index c4bfbaf3..07e6060b 100644
--- a/client/modules/IDE/components/SignupForm.jsx
+++ b/client/modules/User/components/SignupForm.jsx
@@ -5,42 +5,46 @@ function SignupForm(props) {
const { fields: { username, email, password, confirmPassword }, handleSubmit, submitting, invalid, pristine } = props;
return (