Skip to content
Permalink
Browse files Browse the repository at this point in the history
Fix token present in referrer header (#2413)
  • Loading branch information
akshaysasidrn committed Mar 3, 2022
1 parent f7ddae8 commit eacbfc4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
17 changes: 14 additions & 3 deletions frontend/src/App/App.jsx
@@ -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';
Expand Down Expand Up @@ -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"
Expand Down
Expand Up @@ -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);
}
Expand All @@ -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 });

Expand Down Expand Up @@ -203,4 +203,4 @@ class InvitationPage extends React.Component {
}
}

export { InvitationPage };
export { ConfirmationPage };
1 change: 1 addition & 0 deletions frontend/src/ConfirmationPage/index.js
@@ -0,0 +1 @@
export * from './ConfirmationPage';
1 change: 0 additions & 1 deletion frontend/src/InvitationPage/index.js

This file was deleted.

0 comments on commit eacbfc4

Please sign in to comment.