fix: add missing productId to getAccountInfo (#5540)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-05-08 13:23:55 +07:00 committed by GitHub
parent ceb1c95c7c
commit 820bbd1d17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -226,7 +226,13 @@ function toAccountInfo (account: Account): AccountInfo {
return result
}
async function getAccountInfo (ctx: MeasureContext, db: Db, email: string, password: string): Promise<AccountInfo> {
async function getAccountInfo (
ctx: MeasureContext,
db: Db,
productId: string,
email: string,
password: string
): Promise<AccountInfo> {
const account = await getAccount(db, email)
if (account === null) {
throw new PlatformError(new Status(Severity.ERROR, platform.status.AccountNotFound, { account: email }))
@ -285,7 +291,7 @@ export async function login (
): Promise<LoginInfo> {
const email = cleanEmail(_email)
try {
const info = await getAccountInfo(ctx, db, email, password)
const info = await getAccountInfo(ctx, db, productId, email, password)
const result = {
endpoint: getEndpoint(),
email,
@ -1496,7 +1502,7 @@ export async function changePassword (
password: string
): Promise<void> {
const { email } = decodeToken(token)
const account = await getAccountInfo(ctx, db, email, oldPassword)
const account = await getAccountInfo(ctx, db, productId, email, oldPassword)
const salt = randomBytes(32)
const hash = hashWithSalt(password, salt)