diff --git a/keyserver/src/responders/user-responders.js b/keyserver/src/responders/user-responders.js --- a/keyserver/src/responders/user-responders.js +++ b/keyserver/src/responders/user-responders.js @@ -297,16 +297,19 @@ } = await promiseAll(promises); if (userResult.length === 0) { - throw new ServerError('invalid_parameters'); + if (hasMinCodeVersion(viewer.platformDetails, 171)) { + throw new ServerError('invalid_credentials'); + } else { + throw new ServerError('invalid_parameters'); + } } + const userRow = userResult[0]; + if (!userRow.hash || !bcrypt.compareSync(request.password, userRow.hash)) { - if (hasMinCodeVersion(viewer.platformDetails, 99999)) { - throw new ServerError('invalid_parameters'); - } else { - throw new ServerError('invalid_credentials'); - } + throw new ServerError('invalid_credentials'); } + const id = userRow.id.toString(); return await processSuccessfulLogin(viewer, input, id, calendarQuery); }