mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
Пофиксил баг, когда гость мог попасть на страницу профиля при клике по лого сайта
This commit is contained in:
@ -2,17 +2,9 @@ import React, { Component } from 'react';
|
|||||||
|
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
import authFlow from 'services/authFlow';
|
|
||||||
|
|
||||||
class IndexPage extends Component {
|
class IndexPage extends Component {
|
||||||
displayName = 'IndexPage';
|
displayName = 'IndexPage';
|
||||||
|
|
||||||
componentWillMount() {
|
|
||||||
if (this.props.user.isGuest) {
|
|
||||||
authFlow.login();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {user, children} = this.props;
|
const {user, children} = this.props;
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ export default function routesFactory(store) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Route path="/" component={RootPage}>
|
<Route path="/" component={RootPage}>
|
||||||
<IndexRoute component={IndexPage} />
|
<IndexRoute component={IndexPage} {...onEnter} />
|
||||||
|
|
||||||
<Route path="oauth" component={OAuthInit} {...onEnter} />
|
<Route path="oauth" component={OAuthInit} {...onEnter} />
|
||||||
<Route path="logout" component={Logout} {...onEnter} />
|
<Route path="logout" component={Logout} {...onEnter} />
|
||||||
|
@ -23,7 +23,6 @@ export default class AuthFlow {
|
|||||||
const {routing} = this.getState();
|
const {routing} = this.getState();
|
||||||
|
|
||||||
if (routing.location.pathname !== route) {
|
if (routing.location.pathname !== route) {
|
||||||
this.ignoreRequest = true; // TODO: remove me
|
|
||||||
if (this.replace) {
|
if (this.replace) {
|
||||||
this.replace(route);
|
this.replace(route);
|
||||||
}
|
}
|
||||||
@ -62,10 +61,10 @@ export default class AuthFlow {
|
|||||||
throw new Error('State is required');
|
throw new Error('State is required');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state instanceof state.constructor) {
|
// if (this.state instanceof state.constructor) {
|
||||||
// already in this state
|
// // already in this state
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
this.state && this.state.leave(this);
|
this.state && this.state.leave(this);
|
||||||
this.state = state;
|
this.state = state;
|
||||||
@ -74,10 +73,6 @@ export default class AuthFlow {
|
|||||||
|
|
||||||
handleRequest(path, replace) {
|
handleRequest(path, replace) {
|
||||||
this.replace = replace;
|
this.replace = replace;
|
||||||
if (this.ignoreRequest) {
|
|
||||||
this.ignoreRequest = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (path) {
|
switch (path) {
|
||||||
case '/oauth':
|
case '/oauth':
|
||||||
@ -92,6 +87,7 @@ export default class AuthFlow {
|
|||||||
this.setState(new ForgotPasswordState());
|
this.setState(new ForgotPasswordState());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case '/':
|
||||||
case '/login':
|
case '/login':
|
||||||
case '/password':
|
case '/password':
|
||||||
case '/activation':
|
case '/activation':
|
||||||
|
Reference in New Issue
Block a user