Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove passage client initialization from sign-up screen #4642

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 0 additions & 74 deletions src/components/SignUp/SignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import styled from 'styled-components';
import Button from 'UI/Controls/Button';
import CheckBoxInput from 'UI/Inputs/CheckBoxInput';
import TextInput from 'UI/Inputs/TextInput';
import ErrorReporter from 'utils/errors/ErrorReporter';
import { FlashMessage, messageTTL, messageType } from 'utils/flashMessage';
import Passage from 'utils/passageClient';
import { validatePassword } from 'utils/passwordValidation';

import StatusMessage from './StatusMessage';
Expand Down Expand Up @@ -101,8 +99,6 @@ const Wrapper = styled('div')`
}
`;

const passage = new Passage({ endpoint: window.config.passageEndpoint });

interface MatchParams {
token: string;
}
Expand Down Expand Up @@ -176,49 +172,6 @@ class SignUp extends React.Component<ISignUpProps, ISignUpState> {

componentDidMount() {
this.isComponentMounted = true;
const token = this.props.match.params.token;
const statusMessageChangeTimeout = 800;

passage
.checkInvite({ token })
.then((data) => {
this.setState({
email: data.email,
statusMessage: 'verify_completed',
// eslint-disable-next-line react/no-unused-state
checkInviteStatus: 'completed',
});

setTimeout(() => {
if (this.isComponentMounted) {
this.setState({
statusMessage: 'enter_password',
});

this.advanceForm();
}
}, statusMessageChangeTimeout);
})
.catch((error) => {
this.setState({
// eslint-disable-next-line react/no-unused-state
checkInviteStatus: 'failed',
});

let statusMessage = 'verify_failed';

if (error.message === 'InvalidToken') {
statusMessage = 'invalid_token';
}

this.setState({
statusMessage: statusMessage,
});

if (error.message !== 'InvalidToken') {
ErrorReporter.getInstance().notify(error as Error);
}
});
}

componentDidUpdate(prevProps: ISignUpProps) {
Expand Down Expand Up @@ -284,33 +237,6 @@ class SignUp extends React.Component<ISignUpProps, ISignUpState> {
statusMessage: 'create_account_starting',
submitting: true,
});

passage
.createAccount({
inviteToken: this.props.match.params.token,
password: this.state.passwordField.value,
})
.then((data) => {
this.setState({
statusMessage: 'create_account_completed',
});

return this.props.actions.giantswarmLogin(
data.email,
this.state.passwordField.value
);
})
.then(() => {
this.accountCreated();
})
.catch((err) => {
this.setState({
statusMessage: 'create_account_failed',
submitting: false,
});

ErrorReporter.getInstance().notify(err as Error);
});
} else {
this.advanceForm();
}
Expand Down
Loading