@@ -21,11 +21,13 @@ const logger = createLogger('GmailAlias')
2121 * Whether an earlier account, banned or not, already holds the Gmail inbox this
2222 * user's address delivers to. Only an account created before this one counts
2323 * (the id breaks a creation-time tie), so the inbox's first account keeps the
24- * allowance however late its own stats row is created. Pass the caller's
25- * transaction as `executor` to read on it; the read then runs in a savepoint,
26- * so a failed lookup never aborts that transaction. Fails open: a lookup error
27- * returns `false` and is logged, because refusing a legitimate person's
28- * allowance is worse than one missed match.
24+ * allowance however late its own stats row is created. It must have verified
25+ * the address, so an account that merely claimed someone else's inbox never
26+ * withholds that person's allowance. Pass the caller's transaction as
27+ * `executor` to read on it; the read then runs in a savepoint, so a failed
28+ * lookup never aborts that transaction. Fails open: a lookup error returns
29+ * `false` and is logged, because refusing a legitimate person's allowance is
30+ * worse than one missed match.
2931 */
3032export async function userHasGmailAliasAccount (
3133 userId : string ,
@@ -45,6 +47,7 @@ export async function userHasGmailAliasAccount(
4547 . where (
4648 and (
4749 sql `${ gmailMailbox ( user . email ) } = ${ self . mailbox } ` ,
50+ eq ( user . emailVerified , true ) ,
4851 or (
4952 lt ( user . createdAt , self . createdAt ) ,
5053 and ( eq ( user . createdAt , self . createdAt ) , lt ( user . id , userId ) )
0 commit comments