mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
token validation changes
This commit is contained in:
parent
f13636ce1a
commit
3d9aacd6e6
1 changed files with 11 additions and 10 deletions
|
@ -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({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue