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

Function onLoginCheck

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

Source from the content-addressed store, hash-verified

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