mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2026-08-31 19:03:45 +02:00
Fix invalidating auth token when device reports uninstall
This commit is contained in:
@@ -35,6 +35,8 @@ export async function reportDeviceRemoved ({ database, deviceAuthToken, websocke
|
||||
})
|
||||
|
||||
if (deviceEntry) {
|
||||
const currentAuthToken = deviceEntry.deviceAuthToken
|
||||
|
||||
deviceEntry.didDeviceReportUninstall = true
|
||||
deviceEntry.deviceAuthToken = generateAuthToken() // invalidiate the token
|
||||
deviceEntry.save({ transaction })
|
||||
@@ -51,7 +53,7 @@ export async function reportDeviceRemoved ({ database, deviceAuthToken, websocke
|
||||
|
||||
// add to old devices
|
||||
await database.oldDevice.create({
|
||||
deviceAuthToken: deviceEntry.deviceAuthToken
|
||||
deviceAuthToken: currentAuthToken
|
||||
}, {
|
||||
transaction
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user