mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
Fix token present in referrer header (#2413)
This commit is contained in:
parent
f7ddae899f
commit
eacbfc4c9d
4 changed files with 19 additions and 8 deletions
|
|
@ -1,12 +1,12 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Router, Route } from 'react-router-dom';
|
import { Router, Route, Redirect } from 'react-router-dom';
|
||||||
import { history } from '@/_helpers';
|
import { history } from '@/_helpers';
|
||||||
import { authenticationService, tooljetService } from '@/_services';
|
import { authenticationService, tooljetService } from '@/_services';
|
||||||
import { PrivateRoute } from '@/_components';
|
import { PrivateRoute } from '@/_components';
|
||||||
import { HomePage } from '@/HomePage';
|
import { HomePage } from '@/HomePage';
|
||||||
import { LoginPage } from '@/LoginPage';
|
import { LoginPage } from '@/LoginPage';
|
||||||
import { SignupPage } from '@/SignupPage';
|
import { SignupPage } from '@/SignupPage';
|
||||||
import { InvitationPage } from '@/InvitationPage';
|
import { ConfirmationPage } from '@/ConfirmationPage';
|
||||||
import { Authorize } from '@/Oauth2';
|
import { Authorize } from '@/Oauth2';
|
||||||
import { Authorize as Oauth } from '@/Oauth';
|
import { Authorize as Oauth } from '@/Oauth';
|
||||||
import { Editor, Viewer } from '@/Editor';
|
import { Editor, Viewer } from '@/Editor';
|
||||||
|
|
@ -118,7 +118,18 @@ class App extends React.Component {
|
||||||
<Route path="/signup" component={SignupPage} />
|
<Route path="/signup" component={SignupPage} />
|
||||||
<Route path="/forgot-password" component={ForgotPassword} />
|
<Route path="/forgot-password" component={ForgotPassword} />
|
||||||
<Route path="/reset-password" component={ResetPassword} />
|
<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
|
<PrivateRoute
|
||||||
exact
|
exact
|
||||||
path="/apps/:id"
|
path="/apps/:id"
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@ import { userService } from '@/_services';
|
||||||
import { toast } from 'react-hot-toast';
|
import { toast } from 'react-hot-toast';
|
||||||
import queryString from 'query-string';
|
import queryString from 'query-string';
|
||||||
|
|
||||||
class InvitationPage extends React.Component {
|
class ConfirmationPage extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
newSignup: queryString.parse(props.location.search).signup,
|
newSignup: queryString.parse(props.location.state.search).signup,
|
||||||
};
|
};
|
||||||
this.formRef = React.createRef(null);
|
this.formRef = React.createRef(null);
|
||||||
}
|
}
|
||||||
|
|
@ -26,7 +26,7 @@ class InvitationPage extends React.Component {
|
||||||
setPassword = (e) => {
|
setPassword = (e) => {
|
||||||
e.preventDefault();
|
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;
|
const { password, organization, role, newSignup, firstName, lastName, password_confirmation } = this.state;
|
||||||
this.setState({ isLoading: true });
|
this.setState({ isLoading: true });
|
||||||
|
|
||||||
|
|
@ -203,4 +203,4 @@ class InvitationPage extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { InvitationPage };
|
export { ConfirmationPage };
|
||||||
1
frontend/src/ConfirmationPage/index.js
Normal file
1
frontend/src/ConfirmationPage/index.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export * from './ConfirmationPage';
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export * from './InvitationPage';
|
|
||||||
Loading…
Reference in a new issue