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

Revert "Add switch accounts interstitial to login flow" #10437

Merged
Merged
Changes from all 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
44 changes: 1 addition & 43 deletions src/ui/components/shared/Login/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import { gql } from "@apollo/client";
import { ExclamationIcon } from "@heroicons/react/outline";
import Link from "next/link";
import { useRouter } from "next/router";
import { ReactNode, useEffect, useState } from "react";

import { Button } from "replay-next/components/Button";
import { query } from "shared/graphql/apolloClient";
import { GetConnection, GetConnectionVariables } from "shared/graphql/generated/GetConnection";
import { getReadOnlyParamsFromURL } from "shared/utils/environment";
import { isMacOS } from "shared/utils/os";
import { UserInfo, useGetUserInfo } from "ui/hooks/users";
import { getAuthClientId, getAuthHost } from "ui/utils/auth";
import { requestBrowserLogin, setUserInBrowserPrefs } from "ui/utils/browser";
import { isTeamMemberInvite } from "ui/utils/onboarding";
import { sendTelemetryEvent } from "ui/utils/telemetry";
import useAuth0 from "ui/utils/useAuth0";
import useToken from "ui/utils/useToken";

import { OnboardingContentWrapper, OnboardingModalContainer } from "../Onboarding";

Expand Down Expand Up @@ -129,35 +126,6 @@ function LoginMessaging() {
);
}

function SwitchAccountMessage({
user,
onSwitch,
onCancel,
}: {
user: UserInfo;
onCancel: () => void;
onSwitch: () => void;
}) {
return (
<div className="space-y-6">
<p className="text-center text-base">
You are already logged in as <strong>{user.email}</strong>.
</p>
<Button className="w-full justify-center" onClick={onCancel} size="large">
Continue to Library
</Button>
<Button
className="w-full justify-center text-sm font-bold text-primaryAccent underline"
onClick={onSwitch}
size="large"
variant="outline"
>
Switch Accounts
</Button>
</div>
);
}

function SocialLogin({
onShowSSOLogin,
onLogin,
Expand Down Expand Up @@ -274,12 +242,8 @@ export default function Login({
challenge?: string;
state?: string;
}) {
const router = useRouter();
const { loginWithRedirect, error } = useAuth0();
const [sso, setSSO] = useState(false);
const [continueToLogin, setContinueToLogin] = useState(false);
const token = useToken();
const user = useGetUserInfo();

const url = new URL(returnToPath, window.location.origin);
if (url.pathname === "/login" || (url.pathname === "/" && url.searchParams.has("state"))) {
Expand Down Expand Up @@ -309,13 +273,7 @@ export default function Login({
return (
<OnboardingModalContainer theme="light">
<OnboardingContentWrapper overlay>
{token.token && user.email && !continueToLogin ? (
<SwitchAccountMessage
user={user}
onSwitch={() => setContinueToLogin(true)}
onCancel={() => router.push("/")}
/>
) : global.__IS_RECORD_REPLAY_RUNTIME__ && isOSX ? (
{global.__IS_RECORD_REPLAY_RUNTIME__ && isOSX ? (
<ReplayBrowserLogin />
) : sso ? (
<SSOLogin onLogin={onLogin} />
Expand Down
Loading