Skip to content
Open
Show file tree
Hide file tree
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
20 changes: 7 additions & 13 deletions src/components/AuthenticationStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { Button } from "./ui/button";
import { Input } from "./ui/input";
import { AlertCircle, ArrowRight, Building2, Check, Loader2, ChevronLeft } from "lucide-react";
import logger from "../utils/logger";
import { getCachedPlatform } from "../utils/platform";
import ForgotPasswordView from "./ForgotPasswordView";
import { CompactOnboardingFrame } from "./onboarding/OnboardingShell";

Expand Down Expand Up @@ -139,7 +138,6 @@ export default function AuthenticationStep({
const [error, setError] = useState<string | null>(null);
const [forgotPasswordOpen, setForgotPasswordOpen] = useState(false);
const [oauthProtocolRegistered, setOauthProtocolRegistered] = useState(true);
const isMacOS = getCachedPlatform() === "darwin";

const needsVerificationRef = useRef(false);

Expand Down Expand Up @@ -612,17 +610,13 @@ export default function AuthenticationStep({
onClick: () => handleSocialSignIn("google"),
loading: isSocialLoading === "google",
},
...(isMacOS
? [
{
id: "apple",
label: "Apple",
icon: AppleIcon,
onClick: () => handleSocialSignIn("apple"),
loading: isSocialLoading === "apple",
},
]
: []),
{
id: "apple",
label: "Apple",
icon: AppleIcon,
onClick: () => handleSocialSignIn("apple"),
loading: isSocialLoading === "apple",
},
{
id: "microsoft",
label: "Microsoft",
Expand Down
17 changes: 15 additions & 2 deletions test/components/authenticationStep.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function createHarness(values = {}) {
refCursor: 0,
values,
refs: {},
socialSignIns: [],
discoveryCalls: [],
discoveryResult: { exists: false },
discoveryError: null,
Expand All @@ -39,7 +40,7 @@ async function settleAsyncHandler() {
await new Promise((resolve) => setImmediate(resolve));
}

test("email authentication discovers accounts before choosing sign-in or sign-up", async (t) => {
test("authentication discovers accounts and exposes Apple sign-in off macOS", async (t) => {
installBrowserGlobals(t, { window: { electronAPI: {} } });
t.after(() => {
delete globalThis.__authenticationStepHarness;
Expand Down Expand Up @@ -98,7 +99,10 @@ test("email authentication discovers accounts before choosing sign-in or sign-up
},
signIn: { async email() { return {}; } },
};
export async function signInWithSocial() { return {}; }
export async function signInWithSocial(provider) {
globalThis.__authenticationStepHarness.socialSignIns.push(provider);
return {};
}
export async function signInWithSSO() { return {}; }
export function updateLastSignInTime() {}
`,
Expand Down Expand Up @@ -198,4 +202,13 @@ test("email authentication discovers accounts before choosing sign-in or sign-up
assert.equal(duplicateRace.values[AUTH_MODE_INDEX], "sign-in");
assert.equal(duplicateRace.values[PASSWORD_INDEX], "");
assert.equal(duplicateRace.values[ERROR_INDEX], "auth.errors.accountExistsSignIn");

const linuxSocialSignIn = createHarness();
const appleProvider = findElement(
render(linuxSocialSignIn),
(node) => node.props?.label === "Apple" && typeof node.props?.onClick === "function"
);
assert.ok(appleProvider, "Apple sign-in should render on Linux");
await appleProvider.props.onClick();
assert.deepEqual(linuxSocialSignIn.socialSignIns, ["apple"]);
});
Loading