Fix for an issue detected by user test case.
This commit is contained in:
parent
0db7768e5d
commit
60cb080189
|
@ -2,6 +2,7 @@ const jwt = require("jsonwebtoken")
|
||||||
const CouchDB = require("../../db")
|
const CouchDB = require("../../db")
|
||||||
const ClientDb = require("../../db/clientDb")
|
const ClientDb = require("../../db/clientDb")
|
||||||
const bcrypt = require("../../utilities/bcrypt")
|
const bcrypt = require("../../utilities/bcrypt")
|
||||||
|
const { generateUserID } = require("../../db/utils")
|
||||||
|
|
||||||
exports.authenticate = async ctx => {
|
exports.authenticate = async ctx => {
|
||||||
if (!ctx.user.appId) ctx.throw(400, "No appId")
|
if (!ctx.user.appId) ctx.throw(400, "No appId")
|
||||||
|
@ -35,7 +36,7 @@ exports.authenticate = async ctx => {
|
||||||
|
|
||||||
let dbUser
|
let dbUser
|
||||||
try {
|
try {
|
||||||
dbUser = await instanceDb.get(`user_${username}`)
|
dbUser = await instanceDb.get(generateUserID(username))
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
// do not want to throw a 404 - as this could be
|
// do not want to throw a 404 - as this could be
|
||||||
// used to dtermine valid usernames
|
// used to dtermine valid usernames
|
||||||
|
|
Loading…
Reference in New Issue