MCPcopy Create free account
hub / github.com/dailydotdev/apps / onLoginCheck

Function onLoginCheck

packages/shared/src/components/auth/AuthOptionsInner.tsx:433–471  ·  view source on GitHub ↗
(shouldVerify?: boolean)

Source from the content-addressed store, hash-verified

431 };
432
433 const onLoginCheck = async (shouldVerify?: boolean) => {
434 if (shouldVerify) {
435 setEmailVerificationReturn(AuthDisplay.Default);
436 onSetActiveDisplay(AuthDisplay.EmailVerification);
437 return;
438 }
439
440 if (isRegistration) {
441 return;
442 }
443
444 if (!user || handleLoginCheck === false) {
445 return;
446 }
447
448 setHandleLoginCheck(handleLoginCheck === null);
449
450 if (user.infoConfirmed) {
451 logEvent({
452 event_name: AuthEventNames.LoginSuccessfully,
453 });
454
455 // Check for claimable items on login (e.g., Plus subscription)
456 claimClaimableItem().then((hasClaimed) => {
457 if (hasClaimed) {
458 refetchBoot();
459 }
460 });
461
462 const isAlreadyOnboarded = await checkForOnboardedUser(user);
463 if (!isAlreadyOnboarded) {
464 onSuccessfulLogin?.();
465 }
466 } else if (autoProfileTriggers.includes(trigger)) {
467 await autoCompleteProfile(user.email, user.name);
468 } else {
469 onSetActiveDisplay(AuthDisplay.SocialRegistration);
470 }
471 };
472
473 useEffect(() => {
474 onLoginCheck();

Callers 1

AuthOptionsInnerFunction · 0.85

Calls 6

claimClaimableItemFunction · 0.90
onSetActiveDisplayFunction · 0.85
logEventFunction · 0.85
checkForOnboardedUserFunction · 0.85
onSuccessfulLoginFunction · 0.85
autoCompleteProfileFunction · 0.85

Tested by

no test coverage detected