token validation changes

This commit is contained in:
mrfry 2023-04-02 16:35:04 +02:00
parent f13636ce1a
commit 3d9aacd6e6

View file

@ -327,7 +327,7 @@ function setup(data: SubmoduleData): Submodule {
if (specifiedUser.length === 0) { if (specifiedUser.length === 0) {
res.json({ res.json({
result: 'nouser', result: 'nouserid',
msg: 'couldnt find user', msg: 'couldnt find user',
}) })
} }
@ -338,16 +338,17 @@ function setup(data: SubmoduleData): Submodule {
result: 'success', result: 'success',
isValid: isValid, isValid: isValid,
}) })
} else if ((token || userid) && !isQueryValid) {
res.json({
result: 'invalid',
msg: 'token or user id is not valid, or undefined',
})
} else if (!user) {
res.json({
result: 'nouser',
msg: 'you are not logged in',
})
} else { } else {
if (!user) {
res.json({
result: 'invalid',
msg: isQueryValid
? 'you are not logged in'
: 'token or user id is not valid',
})
return
}
const key = v5(validationTokenName, user.pw) const key = v5(validationTokenName, user.pw)
res.json({ res.json({