mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-28 07:50:32 +05:30
Пофиксил баг, когда гость мог попасть на страницу профиля при клике по лого сайта
This commit is contained in:
parent
41015ca336
commit
2ad00d27ff
@ -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;
|
||||
|
||||
|
@ -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} />
|
||||
|
@ -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':
|
||||
|
Loading…
Reference in New Issue
Block a user