Пофиксил баг, когда гость мог попасть на страницу профиля при клике по лого сайта

This commit is contained in:
SleepWalker 2016-03-13 11:02:24 +02:00
parent 41015ca336
commit 2ad00d27ff
3 changed files with 6 additions and 18 deletions

View File

@ -2,17 +2,9 @@ import React, { Component } from 'react';
import { connect } from 'react-redux';
import authFlow from 'services/authFlow';
class IndexPage extends Component {
displayName = 'IndexPage';
componentWillMount() {
if (this.props.user.isGuest) {
authFlow.login();
}
}
render() {
const {user, children} = this.props;

View File

@ -34,7 +34,7 @@ export default function routesFactory(store) {
return (
<Route path="/" component={RootPage}>
<IndexRoute component={IndexPage} />
<IndexRoute component={IndexPage} {...onEnter} />
<Route path="oauth" component={OAuthInit} {...onEnter} />
<Route path="logout" component={Logout} {...onEnter} />

View File

@ -23,7 +23,6 @@ export default class AuthFlow {
const {routing} = this.getState();
if (routing.location.pathname !== route) {
this.ignoreRequest = true; // TODO: remove me
if (this.replace) {
this.replace(route);
}
@ -62,10 +61,10 @@ export default class AuthFlow {
throw new Error('State is required');
}
if (this.state instanceof state.constructor) {
// already in this state
return;
}
// if (this.state instanceof state.constructor) {
// // already in this state
// return;
// }
this.state && this.state.leave(this);
this.state = state;
@ -74,10 +73,6 @@ export default class AuthFlow {
handleRequest(path, replace) {
this.replace = replace;
if (this.ignoreRequest) {
this.ignoreRequest = false;
return;
}
switch (path) {
case '/oauth':
@ -92,6 +87,7 @@ export default class AuthFlow {
this.setState(new ForgotPasswordState());
break;
case '/':
case '/login':
case '/password':
case '/activation':