Fix token present in referrer header (#2413)

This commit is contained in:
Akshay 2022-03-03 20:16:35 +05:30 committed by GitHub
parent f7ddae899f
commit eacbfc4c9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 8 deletions

View file

@ -1,12 +1,12 @@
import React from 'react';
import { Router, Route } from 'react-router-dom';
import { Router, Route, Redirect } from 'react-router-dom';
import { history } from '@/_helpers';
import { authenticationService, tooljetService } from '@/_services';
import { PrivateRoute } from '@/_components';
import { HomePage } from '@/HomePage';
import { LoginPage } from '@/LoginPage';
import { SignupPage } from '@/SignupPage';
import { InvitationPage } from '@/InvitationPage';
import { ConfirmationPage } from '@/ConfirmationPage';
import { Authorize } from '@/Oauth2';
import { Authorize as Oauth } from '@/Oauth';
import { Editor, Viewer } from '@/Editor';
@ -118,7 +118,18 @@ class App extends React.Component {
<Route path="/signup" component={SignupPage} />
<Route path="/forgot-password" component={ForgotPassword} />
<Route path="/reset-password" component={ResetPassword} />
<Route path="/invitations/:token" component={InvitationPage} />
<Route
path="/invitations/:token"
render={(props) => (
<Redirect
to={{
pathname: '/confirm',
state: { token: props.match.params.token, search: props.location.search },
}}
/>
)}
/>
<Route path="/confirm" component={ConfirmationPage} />
<PrivateRoute
exact
path="/apps/:id"

View file

@ -3,13 +3,13 @@ import { userService } from '@/_services';
import { toast } from 'react-hot-toast';
import queryString from 'query-string';
class InvitationPage extends React.Component {
class ConfirmationPage extends React.Component {
constructor(props) {
super(props);
this.state = {
isLoading: false,
newSignup: queryString.parse(props.location.search).signup,
newSignup: queryString.parse(props.location.state.search).signup,
};
this.formRef = React.createRef(null);
}
@ -26,7 +26,7 @@ class InvitationPage extends React.Component {
setPassword = (e) => {
e.preventDefault();
const token = this.props.match.params.token;
const token = this.props.location.state.token;
const { password, organization, role, newSignup, firstName, lastName, password_confirmation } = this.state;
this.setState({ isLoading: true });
@ -203,4 +203,4 @@ class InvitationPage extends React.Component {
}
}
export { InvitationPage };
export { ConfirmationPage };

View file

@ -0,0 +1 @@
export * from './ConfirmationPage';

View file

@ -1 +0,0 @@
export * from './InvitationPage';