<commit_before>/*
 * This file is part of the Kreta package.
 *
 * (c) <NAME> <<EMAIL>>
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

import React from 'react';
import {IndexRoute, Route} from 'react-router';

import BaseLayout from './views/layout/Base';
import Dashboard from './views/page/Dashboard';
import IssueNew from './views/page/issue/New';
import IssueEdit from './views/page/issue/Edit';
import IssueShow from './views/page/issue/Show';
import LoginPage from './views/page/Login';
import OrganizationNew from './views/page/organization/New';
import Profile from './views/page/profile/Edit';
import ProjectNew from './views/page/project/New';
import ProjectRoot from './views/page/project/Root';
import ProjectSettings from './views/page/project/Settings';
import ProjectShow from './views/page/project/IssueList';
import Security from './api/rest/User/Security';

const requireAuth = (nextState, replace) => {
  if (!Security.isLoggedIn()) {
    replace({
      pathname: '/login',
      state: {nextPathname: nextState.location.pathname}
    });
  }
};

export default (
  <div>
    <Route component={LoginPage} path="/login"/>
    <Route component={BaseLayout} onEnter={requireAuth} path="/"><commit_msg>Redirected to the / when the user logged accesed to the login<commit_after>/*
 * This file is part of the Kreta package.
 *
 * (c) <NAME> <<EMAIL>>
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

import React from 'react';
import {IndexRoute, Route} from 'react-router';

import BaseLayout from './views/layout/Base';
import Dashboard from './views/page/Dashboard';
import IssueNew from './views/page/issue/New';
import IssueEdit from './views/page/issue/Edit';
import IssueShow from './views/page/issue/Show';
import LoginPage from './views/page/Login';
import OrganizationNew from './views/page/organization/New';
import Profile from './views/page/profile/Edit';
import ProjectNew from './views/page/project/New';
import ProjectRoot from './views/page/project/Root';
import ProjectSettings from './views/page/project/Settings';
import ProjectShow from './views/page/project/IssueList';
import Security from './api/rest/User/Security';

const
  requireAuth = (nextState, replace) => {
    if (!Security.isLoggedIn()) {
      replace({
        pathname: '/login',
        state: {nextPathname: nextState.location.pathname}
      });
    }
  },
  loggedRedirect = (nextState, replace) => {
    if (Security.isLoggedIn()) {
      replace({
        pathname: '/',
        state: {nextPathname: nextState.location.pathname}
      });
    }
  };

export default (
  <div>
    <Route component={LoginPage} onEnter={loggedRedirect} path="/login"/>
    <Route component={BaseLayout} onEnter={requireAuth} path="/">
{'fraction_non_alphanumeric': 0.14925373134328357, 'fraction_numerical': 0.0, 'mean_word_length': 3.947986577181208, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3916967', 'n_tokens_mistral': 848, 'n_tokens_neox': 846, 'n_words': 254}