(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
pull/936/head
George Gevoian 1 month ago
parent 03ead0d1ca
commit ddc28e327b

@ -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');

Loading…
Cancel
Save