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:
@@ -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({
|
||||
|
Reference in New Issue
Block a user