diff --git a/src/components/auth/Activation.jsx b/src/components/auth/Activation.jsx
index 4804e9c..b02bf18 100644
--- a/src/components/auth/Activation.jsx
+++ b/src/components/auth/Activation.jsx
@@ -13,7 +13,6 @@ import messages from './Activation.messages';
class Body extends BaseAuthBody {
static propTypes = {
...BaseAuthBody.propTypes,
- activate: PropTypes.func.isRequired,
auth: PropTypes.shape({
error: PropTypes.string,
login: PropTypes.shape({
@@ -48,10 +47,6 @@ class Body extends BaseAuthBody {
);
}
-
- onFormSubmit() {
- this.props.activate(this.serialize());
- }
}
export default function Activation() {
diff --git a/src/components/auth/AppInfo.jsx b/src/components/auth/AppInfo.jsx
index c987088..9a91306 100644
--- a/src/components/auth/AppInfo.jsx
+++ b/src/components/auth/AppInfo.jsx
@@ -22,7 +22,7 @@ export default class AppInfo extends Component {
return (
-
{name}
+ {name || 'Ely Accounts'}
diff --git a/src/components/auth/BaseAuthBody.jsx b/src/components/auth/BaseAuthBody.jsx
index 295f49a..f83412a 100644
--- a/src/components/auth/BaseAuthBody.jsx
+++ b/src/components/auth/BaseAuthBody.jsx
@@ -8,6 +8,8 @@ import AuthError from './AuthError';
export default class BaseAuthBody extends Component {
static propTypes = {
clearErrors: PropTypes.func.isRequired,
+ resolve: PropTypes.func.isRequired,
+ reject: PropTypes.func.isRequired,
auth: PropTypes.shape({
error: PropTypes.string
})
@@ -20,6 +22,10 @@ export default class BaseAuthBody extends Component {
;
}
+ onFormSubmit() {
+ this.props.resolve(this.serialize());
+ }
+
onClearErrors = this.props.clearErrors;
form = {};
diff --git a/src/components/auth/Login.jsx b/src/components/auth/Login.jsx
index 2f17d5c..0bcf7bc 100644
--- a/src/components/auth/Login.jsx
+++ b/src/components/auth/Login.jsx
@@ -14,7 +14,6 @@ import passwordMessages from './Password.messages';
class Body extends BaseAuthBody {
static propTypes = {
...BaseAuthBody.propTypes,
- login: PropTypes.func.isRequired,
auth: PropTypes.shape({
error: PropTypes.string,
login: PropTypes.shape({
@@ -37,10 +36,6 @@ class Body extends BaseAuthBody {
);
}
-
- onFormSubmit() {
- this.props.login(this.serialize());
- }
}
export default function Login() {
diff --git a/src/components/auth/Logout.jsx b/src/components/auth/Logout.jsx
index 6d99ec8..7fcb2bf 100644
--- a/src/components/auth/Logout.jsx
+++ b/src/components/auth/Logout.jsx
@@ -1,25 +1,9 @@
-import React, { Component, PropTypes } from 'react';
+import React, { Component } from 'react';
-import { connect } from 'react-redux';
-
-import { logout } from 'components/auth/actions';
-
-class Logout extends Component {
+export class Logout extends Component {
static displayName = 'Logout';
- static propTypes = {
- logout: PropTypes.func.isRequired
- };
-
- componentWillMount() {
- this.props.logout();
- }
-
render() {
- return
;
+ return
;
}
}
-
-export default connect(null, {
- logout
-})(Logout);
diff --git a/src/components/auth/OAuthInit.jsx b/src/components/auth/OAuthInit.jsx
index 858e327..c9ccd31 100644
--- a/src/components/auth/OAuthInit.jsx
+++ b/src/components/auth/OAuthInit.jsx
@@ -1,43 +1,9 @@
-import React, { Component, PropTypes } from 'react';
+import React, { Component } from 'react';
-import { connect } from 'react-redux';
-
-import { oAuthValidate, oAuthComplete } from 'components/auth/actions';
-
-class OAuthInit extends Component {
+export default class OAuthInit extends Component {
static displayName = 'OAuthInit';
- static propTypes = {
- query: PropTypes.shape({
- client_id: PropTypes.string.isRequired,
- redirect_uri: PropTypes.string.isRequired,
- response_type: PropTypes.string.isRequired,
- scope: PropTypes.string.isRequired,
- state: PropTypes.string
- }),
- validate: PropTypes.func.isRequired
- };
-
- componentWillMount() {
- const {query} = this.props;
-
- this.props.validate({
- clientId: query.client_id,
- redirectUrl: query.redirect_uri,
- responseType: query.response_type,
- scope: query.scope,
- state: query.state
- }).then(this.props.complete);
- }
-
render() {
return
;
}
}
-
-export default connect((state) => ({
- query: state.routing.location.query
-}), {
- validate: oAuthValidate,
- complete: oAuthComplete
-})(OAuthInit);
diff --git a/src/components/auth/PanelTransition.jsx b/src/components/auth/PanelTransition.jsx
index 229318f..ae3bc43 100644
--- a/src/components/auth/PanelTransition.jsx
+++ b/src/components/auth/PanelTransition.jsx
@@ -1,7 +1,6 @@
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
-import { routeActions } from 'react-router-redux';
import { TransitionMotion, spring } from 'react-motion';
import ReactHeight from 'react-height';
@@ -10,6 +9,7 @@ import { Form } from 'components/ui/Form';
import {helpLinks as helpLinksStyles} from 'components/auth/helpLinks.scss';
import panelStyles from 'components/ui/panel.scss';
import icons from 'components/ui/icons.scss';
+import authFlow from 'services/authFlow';
import * as actions from './actions';
@@ -28,7 +28,6 @@ class PanelTransition extends Component {
password: PropTypes.string
})
}).isRequired,
- goBack: React.PropTypes.func.isRequired,
setError: React.PropTypes.func.isRequired,
clearErrors: React.PropTypes.func.isRequired,
path: PropTypes.string.isRequired,
@@ -211,8 +210,7 @@ class PanelTransition extends Component {
onGoBack = (event) => {
event.preventDefault();
- this.body.onGoBack && this.body.onGoBack();
- this.props.goBack();
+ authFlow.goBack();
};
getHeader(key, props) {
@@ -341,14 +339,10 @@ class PanelTransition extends Component {
export default connect((state) => ({
user: state.user,
auth: state.auth,
- path: state.routing.location.pathname
+ path: state.routing.location.pathname,
+ resolve: authFlow.resolve.bind(authFlow),
+ reject: authFlow.reject.bind(authFlow)
}), {
- goBack: routeActions.goBack,
- login: actions.login,
- logout: actions.logout,
- register: actions.register,
- activate: actions.activate,
clearErrors: actions.clearErrors,
- oAuthComplete: actions.oAuthComplete,
setError: actions.setError
})(PanelTransition);
diff --git a/src/components/auth/Password.jsx b/src/components/auth/Password.jsx
index 3585610..2c3913f 100644
--- a/src/components/auth/Password.jsx
+++ b/src/components/auth/Password.jsx
@@ -15,8 +15,6 @@ import messages from './Password.messages';
class Body extends BaseAuthBody {
static propTypes = {
...BaseAuthBody.propTypes,
- login: PropTypes.func.isRequired,
- logout: PropTypes.func.isRequired,
auth: PropTypes.shape({
error: PropTypes.string,
login: PropTypes.shape({
@@ -56,17 +54,6 @@ class Body extends BaseAuthBody {
);
}
-
- onFormSubmit() {
- this.props.login({
- ...this.serialize(),
- login: this.props.user.email || this.props.user.username
- });
- }
-
- onGoBack() {
- this.props.logout();
- }
}
export default function Password() {
diff --git a/src/components/auth/PasswordChange.jsx b/src/components/auth/PasswordChange.jsx
index cb8302c..a326232 100644
--- a/src/components/auth/PasswordChange.jsx
+++ b/src/components/auth/PasswordChange.jsx
@@ -15,15 +15,7 @@ import styles from './passwordChange.scss';
class Body extends BaseAuthBody {
static propTypes = {
- ...BaseAuthBody.propTypes/*,
- // Я так полагаю, это правила валидации?
- login: PropTypes.func.isRequired,
- auth: PropTypes.shape({
- error: PropTypes.string,
- login: PropTypes.shape({
- login: PropTypes.stirng
- })
- })*/
+ ...BaseAuthBody.propTypes
};
render() {
@@ -56,10 +48,6 @@ class Body extends BaseAuthBody {
);
}
-
- onFormSubmit() {
- this.props.login(this.serialize());
- }
}
export default function PasswordChange() {
@@ -75,10 +63,14 @@ export default function PasswordChange() {