Download mobile/src/utils/auth/confirmLinkSignIn.ts from Anirudh1950/MentraOS: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/Anirudh1950/MentraOS/resolve/main/mobile/src/utils/auth/confirmLinkSignIn.ts
- Command line
-
hf download hf://Anirudh1950/MentraOS/mobile/src/utils/auth/confirmLinkSignIn.ts
-
curl -L -o confirmLinkSignIn.ts https://huggingface.co/Anirudh1950/MentraOS/resolve/main/mobile/src/utils/auth/confirmLinkSignIn.ts
1.03 kB
| import {showAlert} from "@/contexts/ModalContext" | |
| import {translate} from "@/i18n" | |
| import type {LinkSignInAccount} from "@/utils/auth/authProvider.types" | |
| /** | |
| * Asks before an email link signs the phone in to an account it didn't start signing up for, naming that account and | |
| * the one signed in now. Only an explicit "Sign in" accepts; dismissing it, or no alert host, declines. | |
| */ | |
| export async function confirmLinkSignIn({email, current}: LinkSignInAccount): Promise<boolean> { | |
| const message = !current | |
| ? translate("login:linkSignInMessage", {email}) | |
| : current.email | |
| ? translate("login:linkSignInSwitchMessage", {email, current: current.email}) | |
| : translate("login:linkSignInSwitchUnknownMessage", {email}) | |
| const answer = await showAlert({ | |
| title: translate("login:linkSignInTitle"), | |
| message, | |
| buttons: [{text: translate("common:cancel"), style: "cancel"}, {text: translate("login:linkSignInContinue")}], | |
| options: {allowDismiss: true}, | |
| }) | |
| return answer === 1 | |
| } | |