From ddc28e327bfb924626b45631e1ade068f6e34582 Mon Sep 17 00:00:00 2001 From: George Gevoian Date: Mon, 8 Apr 2024 10:20:50 -0700 Subject: [PATCH] (core) Use login email to match billing profile Summary: The login email was being used for the "email" parameter of a billing endpoint, but the endpoint was checking it against the non-login email when looking for a matching profile. Test Plan: Manual. Reviewers: dsagal Reviewed By: dsagal Subscribers: dsagal Differential Revision: https://phab.getgrist.com/D4226 --- test/nbrowser/homeUtil.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/nbrowser/homeUtil.ts b/test/nbrowser/homeUtil.ts index 31690a8c..f19bfc58 100644 --- a/test/nbrowser/homeUtil.ts +++ b/test/nbrowser/homeUtil.ts @@ -9,6 +9,7 @@ import fetch from 'node-fetch'; import {authenticator} from 'otplib'; import * as path from 'path'; +import {normalizeEmail} from 'app/common/emails'; import {UserProfile} from 'app/common/LoginSessionAPI'; import {BehavioralPrompt, UserPrefs, WelcomePopup} from 'app/common/Prefs'; import {DocWorkerAPI, UserAPI, UserAPIImpl} from 'app/common/UserAPI'; @@ -105,7 +106,11 @@ export class HomeUtil { const testingHooks = await this.server.getTestingHooks(); const sid = await this.getGristSid(); if (!sid) { throw new Error('no session available'); } - await testingHooks.setLoginSessionProfile(sid, {name, email, loginMethod}, org); + await testingHooks.setLoginSessionProfile( + sid, + {name, email, loginEmail: normalizeEmail(email), loginMethod}, + org + ); } else { if (loginMethod && loginMethod !== 'Email + Password') { throw new Error('only Email + Password logins supported for external server tests');