create-warlock 1.0.15 → 1.0.17
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 +1 -1
- package/templates/warlock/package.json +8 -8
- package/templates/warlock/src/app/users/controllers/profile/change-password.ts +5 -5
- package/templates/warlock/src/app/users/routes.ts +0 -7
- package/templates/warlock/src/app/utils/router.ts +2 -2
- package/templates/warlock/warlock.config.ts +1 -2
package/package.json
CHANGED
|
@@ -19,24 +19,24 @@
|
|
|
19
19
|
"tsc": "npx tsc --noEmit"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@mongez/collection": "^1.
|
|
22
|
+
"@mongez/collection": "^1.2.0",
|
|
23
23
|
"@mongez/encryption": "^1.0.4",
|
|
24
24
|
"@mongez/fs": "^3.0.5",
|
|
25
25
|
"@mongez/reinforcements": "^2.3.10",
|
|
26
|
-
"@mongez/localization": "^
|
|
26
|
+
"@mongez/localization": "^3.0.0",
|
|
27
27
|
"@mongez/dotenv": "^1.1.9",
|
|
28
28
|
"@mongez/config": "^1.0.26",
|
|
29
29
|
"@mongez/supportive-is": "^2.0.3",
|
|
30
|
-
"@warlock.js/auth": "^
|
|
31
|
-
"@warlock.js/cache": "^
|
|
32
|
-
"@warlock.js/cascade": "^
|
|
33
|
-
"@warlock.js/core": "^
|
|
34
|
-
"@warlock.js/logger": "^
|
|
35
|
-
"@warlock.js/postman": "^1.0.4",
|
|
30
|
+
"@warlock.js/auth": "^2.0.1",
|
|
31
|
+
"@warlock.js/cache": "^2.0.1",
|
|
32
|
+
"@warlock.js/cascade": "^2.0.1",
|
|
33
|
+
"@warlock.js/core": "^2.0.1",
|
|
34
|
+
"@warlock.js/logger": "^2.0.1",
|
|
36
35
|
"dayjs": "^1.11.10"
|
|
37
36
|
},
|
|
38
37
|
"devDependencies": {
|
|
39
38
|
"eslint": "^8.53.0",
|
|
39
|
+
"@types/react": "^18.3.3",
|
|
40
40
|
"@typescript-eslint/eslint-plugin": "^6.11.0",
|
|
41
41
|
"@typescript-eslint/parser": "^6.11.0",
|
|
42
42
|
"eslint-config-prettier": "^9.0.0",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { v, type Request, type Response } from "@warlock.js/core";
|
|
2
2
|
import type { User } from "app/users/models/user";
|
|
3
3
|
|
|
4
4
|
export default async function changePassword(
|
|
@@ -15,10 +15,10 @@ export default async function changePassword(
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
changePassword.validation = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
18
|
+
schema: v.object({
|
|
19
|
+
password: v.string().minLength(8).required(),
|
|
20
|
+
confirmPassword: v.string().required().matches("password"),
|
|
21
|
+
}),
|
|
22
22
|
validate: (request: Request<User>, response: Response) => {
|
|
23
23
|
const user = request.user;
|
|
24
24
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { guestLogin } from "@warlock.js/auth";
|
|
2
1
|
import { router } from "@warlock.js/core";
|
|
3
2
|
import {
|
|
4
|
-
adminPath,
|
|
5
3
|
guarded,
|
|
6
4
|
guardedAdmin,
|
|
7
5
|
guardedGuest,
|
|
@@ -21,11 +19,6 @@ import myProfile from "./controllers/profile/my-profile";
|
|
|
21
19
|
import updateProfile from "./controllers/profile/update-profile";
|
|
22
20
|
import { restfulUsers } from "./controllers/restful-users";
|
|
23
21
|
|
|
24
|
-
// guest login
|
|
25
|
-
// If you are going to use guest as a user type, you can use this route
|
|
26
|
-
// otherwise, you can remove this route, also you may remove the guest model from the src/config/auth.ts config file
|
|
27
|
-
router.post([adminPath("/login/guests"), "/login/guests"], guestLogin);
|
|
28
|
-
|
|
29
22
|
// admin auth
|
|
30
23
|
guardedGuestAdmin(() => {
|
|
31
24
|
router.post("/login", adminLogin);
|
|
@@ -53,7 +53,7 @@ export const guardedGuest = (callback: RouterGroupCallback) => {
|
|
|
53
53
|
return router.group(
|
|
54
54
|
{
|
|
55
55
|
name: "guarded.guest",
|
|
56
|
-
middleware: [authMiddleware(
|
|
56
|
+
middleware: [authMiddleware()],
|
|
57
57
|
},
|
|
58
58
|
callback,
|
|
59
59
|
);
|
|
@@ -67,7 +67,7 @@ export const guardedGuestAdmin = (callback: RouterGroupCallback) => {
|
|
|
67
67
|
router.group(
|
|
68
68
|
{
|
|
69
69
|
name: "guarded.guest",
|
|
70
|
-
middleware: [authMiddleware(
|
|
70
|
+
middleware: [authMiddleware()],
|
|
71
71
|
},
|
|
72
72
|
callback,
|
|
73
73
|
);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { registerJWTSecretGeneratorCommand } from "@warlock.js/auth";
|
|
2
2
|
import { defineConfig } from "@warlock.js/core";
|
|
3
|
-
import { registerPostmanCommand } from "@warlock.js/postman";
|
|
4
3
|
|
|
5
4
|
export default defineConfig({
|
|
6
5
|
cli: {
|
|
7
|
-
commands: [
|
|
6
|
+
commands: [registerJWTSecretGeneratorCommand()],
|
|
8
7
|
},
|
|
9
8
|
});
|