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

Function onLoginCheck

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

Source from the content-addressed store, hash-verified

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