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

Function onLoginCheck

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

Source from the content-addressed store, hash-verified

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