mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
even more checks
This commit is contained in:
parent
30711df157
commit
11dacdae64
1 changed files with 10 additions and 3 deletions
|
@ -289,10 +289,17 @@ function setup(data: SubmoduleData): Submodule {
|
|||
const { token, userid } = req.query
|
||||
|
||||
if (validateuuid(token) && !Number.isNaN(+userid)) {
|
||||
const specifiedUser: User = dbtools.Select(userDB, 'users', {
|
||||
const specifiedUser = dbtools.Select(userDB, 'users', {
|
||||
id: +userid,
|
||||
})[0]
|
||||
const key = v5(name, specifiedUser.pw)
|
||||
})
|
||||
|
||||
if (specifiedUser.length === 0) {
|
||||
res.json({
|
||||
result: 'error',
|
||||
msg: 'couldnt find user',
|
||||
})
|
||||
}
|
||||
const key = v5(name, specifiedUser[0].pw)
|
||||
const isValid = key === token
|
||||
|
||||
res.json({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue