@stacksjs/defaults 0.70.363 → 0.70.365
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Action } from '@stacksjs/actions'
|
|
2
|
-
import { Auth } from '@stacksjs/auth'
|
|
2
|
+
import { Auth, clearAuthCookie } from '@stacksjs/auth'
|
|
3
3
|
import { response } from '@stacksjs/router'
|
|
4
4
|
|
|
5
5
|
export default new Action({
|
|
@@ -7,10 +7,17 @@ export default new Action({
|
|
|
7
7
|
description: 'Logout from the application',
|
|
8
8
|
method: 'POST',
|
|
9
9
|
async handle() {
|
|
10
|
+
// `Auth.logout()` resolves the token from the Authorization header or the
|
|
11
|
+
// auth cookie, so this revokes the session either way.
|
|
10
12
|
await Auth.logout()
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
// Clearing is separate from revoking, and both are needed. Revoking alone
|
|
15
|
+
// leaves the browser sending a dead cookie on every request; clearing alone
|
|
16
|
+
// leaves a copied cookie valid for the token's whole lifetime, which would
|
|
17
|
+
// make "log out on a shared computer" mean only "hide the key".
|
|
18
|
+
return response.json(
|
|
19
|
+
{ message: 'Successfully logged out' },
|
|
20
|
+
{ headers: { 'Set-Cookie': clearAuthCookie() } },
|
|
21
|
+
)
|
|
15
22
|
},
|
|
16
23
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Action } from '@stacksjs/actions'
|
|
2
|
-
import { revokeAllTokens, sessionDestroyAll } from '@stacksjs/auth'
|
|
2
|
+
import { clearAuthCookie, revokeAllTokens, sessionDestroyAll } from '@stacksjs/auth'
|
|
3
3
|
import { response } from '@stacksjs/router'
|
|
4
4
|
|
|
5
5
|
export default new Action({
|
|
@@ -21,8 +21,12 @@ export default new Action({
|
|
|
21
21
|
await revokeAllTokens(Number(user.id))
|
|
22
22
|
await sessionDestroyAll(Number(user.id))
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
// This device included: its cookie carries one of the tokens just revoked,
|
|
25
|
+
// so leaving it in place means the browser keeps presenting a dead
|
|
26
|
+
// credential on every request.
|
|
27
|
+
return response.json(
|
|
28
|
+
{ message: 'Successfully logged out from all devices' },
|
|
29
|
+
{ headers: { 'Set-Cookie': clearAuthCookie() } },
|
|
30
|
+
)
|
|
27
31
|
},
|
|
28
32
|
})
|
package/ide/vscode/package.json
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/defaults",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.70.
|
|
5
|
+
"version": "0.70.365",
|
|
6
6
|
"description": "The complete managed Stacks application scaffold, including runtime defaults, AI guidance, editor metadata, and npm-backed project support files.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"license": "MIT",
|