mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
return 401 when auth request is out of sync, closes #1056
This commit is contained in:
parent
13f9d037dc
commit
6b359b7796
@ -16,7 +16,7 @@ const ApiToken = require('../../entities/api_token');
|
||||
|
||||
async function loginSync(req) {
|
||||
if (!await sqlInit.schemaExists()) {
|
||||
return [400, { message: "DB schema does not exist, can't sync." }];
|
||||
return [500, { message: "DB schema does not exist, can't sync." }];
|
||||
}
|
||||
|
||||
const timestampStr = req.body.timestamp;
|
||||
@ -27,7 +27,7 @@ async function loginSync(req) {
|
||||
|
||||
// login token is valid for 5 minutes
|
||||
if (Math.abs(timestamp.getTime() - now.getTime()) > 5 * 60 * 1000) {
|
||||
return [400, { message: 'Auth request time is out of sync, please check that both client and server have correct time.' }];
|
||||
return [401, { message: 'Auth request time is out of sync, please check that both client and server have correct time.' }];
|
||||
}
|
||||
|
||||
const syncVersion = req.body.syncVersion;
|
||||
@ -102,4 +102,4 @@ module.exports = {
|
||||
loginSync,
|
||||
loginToProtectedSession,
|
||||
token
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user