Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing productId to getAccountInfo #5540

Merged
merged 1 commit into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions server/account/src/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }))
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down