create-lyrajs 2.0.1 → 2.0.2
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.
package/package.json
CHANGED
package/template/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccessControl, isAuthenticated, SecurityConfig } from "@lyra-js/core"
|
|
1
|
+
import { AccessControl, Config, isAuthenticated, SecurityConfig } from "@lyra-js/core"
|
|
2
2
|
import {
|
|
3
3
|
Controller,
|
|
4
4
|
Delete,
|
|
@@ -100,7 +100,10 @@ export class AuthController extends Controller {
|
|
|
100
100
|
partitioned: false
|
|
101
101
|
})
|
|
102
102
|
|
|
103
|
+
const base_path = new Config().get("router.base_path")
|
|
104
|
+
|
|
103
105
|
this.res.cookie("RefreshToken", refreshToken, {
|
|
106
|
+
path: `${base_path}/auth`,
|
|
104
107
|
sameSite: "Lax",
|
|
105
108
|
httpOnly: true,
|
|
106
109
|
secure: process.env.ENV === "production",
|
|
@@ -140,8 +143,9 @@ export class AuthController extends Controller {
|
|
|
140
143
|
@Get({ path: "/sign-out" })
|
|
141
144
|
async signOut() {
|
|
142
145
|
try {
|
|
146
|
+
const base_path = new Config().get("router.base_path")
|
|
143
147
|
this.res.clearCookie("Token")
|
|
144
|
-
this.res.clearCookie("RefreshToken")
|
|
148
|
+
this.res.clearCookie("RefreshToken", { path: `${base_path}/auth` })
|
|
145
149
|
return this.res.status(200).json({ message: "Unauthenticated successfully" })
|
|
146
150
|
} catch (error) {
|
|
147
151
|
this.next(error)
|
|
@@ -226,7 +230,8 @@ export class AuthController extends Controller {
|
|
|
226
230
|
await this.userRepository.delete(user.id)
|
|
227
231
|
|
|
228
232
|
this.res.clearCookie("Token")
|
|
229
|
-
|
|
233
|
+
const base_path = new Config().get("router.base_path")
|
|
234
|
+
this.res.clearCookie("RefreshToken", { path: `${base_path}/auth` })
|
|
230
235
|
|
|
231
236
|
this.res.status(200).json({ message: "User deleted successfully" })
|
|
232
237
|
}
|