Skip to content

Commit

Permalink
add: improve user search
Browse files Browse the repository at this point in the history
  • Loading branch information
sirpy committed Sep 22, 2023
1 parent 2044b22 commit 11ef7b3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/server/storage/storageAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,10 @@ const setup = (app: Router, storage: StorageAPI) => {
wrapAsync(async (req, res) => {
const { body } = req
let user = {}
if (body.email) user = await storage.getUsersByEmail(sha3(body.email))
if (body.mobile) user = await storage.getUsersByMobile(sha3(body.mobile))
if (body.email)
user = await storage.getUsersByEmail(body.email.startsWith('0x') === false ? sha3(body.email) : body.email)
if (body.mobile)
user = await storage.getUsersByMobile(body.mobile.startsWith('0x') === false ? sha3(body.mobile) : body.mobile)
if (body.identifier) user = await storage.getUser(body.identifier)

res.json({ ok: 1, user })
Expand Down

0 comments on commit 11ef7b3

Please sign in to comment.