Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 5x 16x 16x | import { APP_ROUTES } from "@/routes/const";
/**
* The link an admin passes on. The token goes in the fragment, which a
* browser never sends to a server, so it is in no access log on the way in;
* the accept page reads it and posts it in a request body.
*/
export function inviteLink(token: string, origin = window.location.origin): string {
return `${origin}${APP_ROUTES.USER.invite}#${token}`;
}
/** The token from the current page's fragment, or null. */
export function tokenFromHash(hash: string): string | null {
const token = hash.replace(/^#/, "").trim();
return token.length >= 16 ? token : null;
}
|