@flink-app/generic-auth-plugin 0.11.15 → 0.11.16

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,4 +1,4 @@
1
- // Generated Tue Feb 25 2025 10:27:54 GMT+0100 (Central European Standard Time)
1
+ // Generated Tue Feb 25 2025 12:57:55 GMT+0100 (Central European Standard Time)
2
2
  import { autoRegisteredHandlers, HttpMethod } from "@flink-app/flink";
3
3
  import * as UserCreate_0 from "../src/handlers/UserCreate";
4
4
  import * as UserLogin_0 from "../src/handlers/UserLogin";
@@ -1,4 +1,4 @@
1
- // Generated Tue Feb 25 2025 10:27:54 GMT+0100 (Central European Standard Time)
1
+ // Generated Tue Feb 25 2025 12:57:55 GMT+0100 (Central European Standard Time)
2
2
  import { autoRegisteredJobs } from "@flink-app/flink";
3
3
  export const jobs = [];
4
4
  autoRegisteredJobs.push(...jobs);
@@ -1,4 +1,4 @@
1
- // Generated Tue Feb 25 2025 10:27:54 GMT+0100 (Central European Standard Time)
1
+ // Generated Tue Feb 25 2025 12:57:55 GMT+0100 (Central European Standard Time)
2
2
  import { autoRegisteredRepos } from "@flink-app/flink";
3
3
  export const repos = [];
4
4
  autoRegisteredRepos.push(...repos);
@@ -29,7 +29,7 @@ import { PutManagementUserRolesByUseridRes } from "../../src/schemas/Management/
29
29
  import { PutManagementUserUsernameByUseridReq } from "../../src/schemas/Management/PutUserUsernameByUseridReq";
30
30
  import { PutManagementUserUsernameByUseridRes } from "../../src/schemas/Management/PutUserUsernameByUseridRes";
31
31
 
32
- // Generated Tue Feb 25 2025 10:27:54 GMT+0100 (Central European Standard Time)
32
+ // Generated Tue Feb 25 2025 12:57:56 GMT+0100 (Central European Standard Time)
33
33
  export interface UserCreate_7_ReqSchema extends UserCreateReq {}
34
34
 
35
35
  export interface UserCreate_7_ResSchema extends UserCreateRes {}
package/.flink/start.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Generated Tue Feb 25 2025 10:27:54 GMT+0100 (Central European Standard Time)
1
+ // Generated Tue Feb 25 2025 12:57:55 GMT+0100 (Central European Standard Time)
2
2
  import "./generatedHandlers";
3
3
  import "./generatedRepos";
4
4
  import "./generatedJobs";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.handlers = void 0;
4
- // Generated Tue Feb 25 2025 10:27:54 GMT+0100 (Central European Standard Time)
4
+ // Generated Tue Feb 25 2025 12:57:55 GMT+0100 (Central European Standard Time)
5
5
  var flink_1 = require("@flink-app/flink");
6
6
  exports.handlers = [];
7
7
  flink_1.autoRegisteredHandlers.push.apply(flink_1.autoRegisteredHandlers, exports.handlers);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.jobs = void 0;
4
- // Generated Tue Feb 25 2025 10:27:54 GMT+0100 (Central European Standard Time)
4
+ // Generated Tue Feb 25 2025 12:57:55 GMT+0100 (Central European Standard Time)
5
5
  var flink_1 = require("@flink-app/flink");
6
6
  exports.jobs = [];
7
7
  flink_1.autoRegisteredJobs.push.apply(flink_1.autoRegisteredJobs, exports.jobs);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.repos = void 0;
4
- // Generated Tue Feb 25 2025 10:27:54 GMT+0100 (Central European Standard Time)
4
+ // Generated Tue Feb 25 2025 12:57:55 GMT+0100 (Central European Standard Time)
5
5
  var flink_1 = require("@flink-app/flink");
6
6
  exports.repos = [];
7
7
  flink_1.autoRegisteredRepos.push.apply(flink_1.autoRegisteredRepos, exports.repos);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // Generated Tue Feb 25 2025 10:27:54 GMT+0100 (Central European Standard Time)
3
+ // Generated Tue Feb 25 2025 12:57:55 GMT+0100 (Central European Standard Time)
4
4
  require("./generatedHandlers");
5
5
  require("./generatedRepos");
6
6
  require("./generatedJobs");
@@ -6,4 +6,5 @@ export declare function handleUserPasswordResetForm(_req: ExpressRequest, res: E
6
6
  export declare function resetPasswordFormScript(req: ExpressRequest, res: ExpressResponse, { completeUrl }: {
7
7
  completeUrl: string;
8
8
  }): Promise<void>;
9
+ export declare function resetPasswordFormCss(res: ExpressResponse): Promise<void>;
9
10
  export declare const __assumedHttpMethod = "", __file = "UserPasswordResetForm.ts", __query: never[], __params: never[];
@@ -39,12 +39,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
39
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = exports.resetPasswordFormScript = exports.handleUserPasswordResetForm = void 0;
42
+ exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = exports.resetPasswordFormCss = exports.resetPasswordFormScript = exports.handleUserPasswordResetForm = void 0;
43
43
  var promises_1 = __importDefault(require("fs/promises"));
44
44
  var flink_1 = require("@flink-app/flink");
45
45
  var handlebars_1 = __importDefault(require("handlebars"));
46
- var defaultTemplate = "<html>\n<head>\n <title>Password reset</title>\n <style>\n * {\n box-sizing: border-box;\n font-family: Arial, Helvetica, sans-serif;\n }\n\n p {\n margin: 0.5rem 0;\n }\n\n body {\n padding: 1rem;\n }\n\n form {\n display: block;\n max-width: 320px;\n }\n\n input {\n width: 100%;\n display: block;\n margin: 0.5rem 0;\n }\n\n #success {\n display: none;\n font-size: 1.2rem;\n color: rgb(0, 177, 115);\n max-width: 350px;\n }\n </style>\n <script src=\"form/script.js\" type=\"text/javascript\"></script>\n</head>\n<body>\n <form id=\"form\">\n <p>Please enter new password</p>\n <input type=\"password\" name=\"password\" placeholder=\"Enter new password\" />\n <input\n type=\"password\"\n name=\"confirmPassword\"\n placeholder=\"Confirm new password\"\n />\n <button id=\"submit-btn\">Submit</button>\n </form>\n <div id=\"success\">Password has been updated, please proceed to login.</div>\n</body>\n</html>\n";
46
+ var defaultTemplate = "<html>\n<head>\n <title>Password reset</title>\n <link rel=\"stylesheet\" href=\"form/style.css\" />\n <script src=\"form/script.js\" type=\"text/javascript\"></script>\n</head>\n<body>\n <form id=\"form\">\n <p>Please enter new password</p>\n <input type=\"password\" name=\"password\" placeholder=\"Enter new password\" />\n <input\n type=\"password\"\n name=\"confirmPassword\"\n placeholder=\"Confirm new password\"\n />\n <button id=\"submit-btn\">Submit</button>\n </form>\n <div id=\"success\">Password has been updated, please proceed to login.</div>\n</body>\n</html>\n";
47
47
  var script = "\n window.onload = () => {\n const urlSearchParams = new URLSearchParams(window.location.search);\n const params = Object.fromEntries(urlSearchParams.entries());\n const { token, code } = params;\n\n if (!token) {\n alert(\"Missing token\");\n } else if (!code) {\n alert(\"Missing code\");\n }\n\n const submitBtnEl = document.getElementById(\"submit-btn\");\n const [passwordInputEl, confirmPasswordEl] =\n document.getElementsByTagName(\"input\");\n\n submitBtnEl.onclick = async (e) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (!passwordInputEl.value) {\n return alert(\"Enter a new password\");\n } else if (passwordInputEl.value !== confirmPasswordEl.value) {\n return alert(\n \"Passwords does not match, make sure that new and confirmed passwords are the same\"\n );\n }\n\n const res = await window.fetch(\"{{completeUrl}}\", {\n method: \"POST\",\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n passwordResetToken: token,\n code: code,\n password: passwordInputEl.value,\n }),\n });\n\n if (res.status > 399) {\n alert(\"Failed to set new password\");\n } else {\n document.getElementById(\"form\").style.display = \"none\";\n document.getElementById(\"success\").style.display = \"block\";\n }\n };\n };\n";
48
+ var style = " * {\n box-sizing: border-box;\n font-family: Arial, Helvetica, sans-serif;\n }\n\n p {\n margin: 0.5rem 0;\n }\n\n body {\n padding: 1rem;\n }\n\n form {\n display: block;\n max-width: 320px;\n }\n\n input {\n width: 100%;\n display: block;\n margin: 0.5rem 0;\n }\n\n #success {\n display: none;\n font-size: 1.2rem;\n color: rgb(0, 177, 115);\n max-width: 350px;\n }\n";
48
49
  function handleUserPasswordResetForm(_req, res, _a) {
49
50
  var templateFile = _a.templateFile, completeUrl = _a.completeUrl;
50
51
  return __awaiter(this, void 0, void 0, function () {
@@ -77,6 +78,16 @@ function resetPasswordFormScript(req, res, _a) {
77
78
  });
78
79
  }
79
80
  exports.resetPasswordFormScript = resetPasswordFormScript;
81
+ function resetPasswordFormCss(res) {
82
+ return __awaiter(this, void 0, void 0, function () {
83
+ return __generator(this, function (_a) {
84
+ res.header("Content-Type", "text/css");
85
+ res.send(style);
86
+ return [2 /*return*/];
87
+ });
88
+ });
89
+ }
90
+ exports.resetPasswordFormCss = resetPasswordFormCss;
80
91
  var cachedTemplate = "";
81
92
  function readTemplate(templateFilename) {
82
93
  return __awaiter(this, void 0, void 0, function () {
package/dist/src/init.js CHANGED
@@ -34,7 +34,7 @@ var postUserRemoveTokenHandler = __importStar(require("./handlers/UserPushRemove
34
34
  var getUserTokenHandler = __importStar(require("./handlers/UserToken"));
35
35
  var UserPasswordResetForm_1 = require("./handlers/UserPasswordResetForm");
36
36
  function init(app, options) {
37
- var _a, _b, _c;
37
+ var _a, _b, _c, _d;
38
38
  if (options.enableUserCreation == null)
39
39
  options.enableUserCreation = true;
40
40
  if (options.enableProfileUpdate == null)
@@ -124,7 +124,10 @@ function init(app, options) {
124
124
  });
125
125
  });
126
126
  (_c = app.expressApp) === null || _c === void 0 ? void 0 : _c.get(options.baseUrl + "/password/reset/form/script.js", function (req, res) {
127
- UserPasswordResetForm_1.resetPasswordFormScript(req, res, { completeUrl: options.baseUrl + "/password/reset/complete", });
127
+ UserPasswordResetForm_1.resetPasswordFormScript(req, res, { completeUrl: options.baseUrl + "/password/reset/complete" });
128
+ });
129
+ (_d = app.expressApp) === null || _d === void 0 ? void 0 : _d.get(options.baseUrl + "/password/reset/form/style.css", function (req, res) {
130
+ UserPasswordResetForm_1.resetPasswordFormCss(res);
128
131
  });
129
132
  }
130
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flink-app/generic-auth-plugin",
3
- "version": "0.11.15",
3
+ "version": "0.11.16",
4
4
  "description": "Flink plugin that provides a generic user authentification solution.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\"",
@@ -30,5 +30,5 @@
30
30
  "ts-node": "^9.1.1",
31
31
  "typescript": "^4.2.4"
32
32
  },
33
- "gitHead": "0f29761331501ccb5678c5da6801fa12f9a23f9d"
33
+ "gitHead": "639288292e47f6d1d6329e2929d0cefba3b3e603"
34
34
  }
@@ -6,38 +6,7 @@ import Handlebars from "handlebars";
6
6
  const defaultTemplate = `<html>
7
7
  <head>
8
8
  <title>Password reset</title>
9
- <style>
10
- * {
11
- box-sizing: border-box;
12
- font-family: Arial, Helvetica, sans-serif;
13
- }
14
-
15
- p {
16
- margin: 0.5rem 0;
17
- }
18
-
19
- body {
20
- padding: 1rem;
21
- }
22
-
23
- form {
24
- display: block;
25
- max-width: 320px;
26
- }
27
-
28
- input {
29
- width: 100%;
30
- display: block;
31
- margin: 0.5rem 0;
32
- }
33
-
34
- #success {
35
- display: none;
36
- font-size: 1.2rem;
37
- color: rgb(0, 177, 115);
38
- max-width: 350px;
39
- }
40
- </style>
9
+ <link rel="stylesheet" href="form/style.css" />
41
10
  <script src="form/script.js" type="text/javascript"></script>
42
11
  </head>
43
12
  <body>
@@ -107,6 +76,38 @@ const script = `
107
76
  };
108
77
  `;
109
78
 
79
+ const style =` * {
80
+ box-sizing: border-box;
81
+ font-family: Arial, Helvetica, sans-serif;
82
+ }
83
+
84
+ p {
85
+ margin: 0.5rem 0;
86
+ }
87
+
88
+ body {
89
+ padding: 1rem;
90
+ }
91
+
92
+ form {
93
+ display: block;
94
+ max-width: 320px;
95
+ }
96
+
97
+ input {
98
+ width: 100%;
99
+ display: block;
100
+ margin: 0.5rem 0;
101
+ }
102
+
103
+ #success {
104
+ display: none;
105
+ font-size: 1.2rem;
106
+ color: rgb(0, 177, 115);
107
+ max-width: 350px;
108
+ }
109
+ `;
110
+
110
111
  export async function handleUserPasswordResetForm(
111
112
  _req: ExpressRequest,
112
113
  res: ExpressResponse,
@@ -127,6 +128,11 @@ export async function resetPasswordFormScript(req: ExpressRequest, res: ExpressR
127
128
  res.send(js);
128
129
  }
129
130
 
131
+ export async function resetPasswordFormCss(res: ExpressResponse) {
132
+ res.header("Content-Type", "text/css");
133
+ res.send(style);
134
+ }
135
+
130
136
  let cachedTemplate = "";
131
137
 
132
138
  async function readTemplate(templateFilename?: string) {
package/src/init.ts CHANGED
@@ -11,7 +11,11 @@ import { GenericAuthPluginOptions } from "./genericAuthPluginOptions";
11
11
  import * as postUserPushRegisterTokenHandler from "./handlers/UserPushRegisterToken";
12
12
  import * as postUserRemoveTokenHandler from "./handlers/UserPushRemoveToken";
13
13
  import * as getUserTokenHandler from "./handlers/UserToken";
14
- import { handleUserPasswordResetForm, resetPasswordFormScript } from "./handlers/UserPasswordResetForm";
14
+ import {
15
+ handleUserPasswordResetForm,
16
+ resetPasswordFormCss,
17
+ resetPasswordFormScript,
18
+ } from "./handlers/UserPasswordResetForm";
15
19
 
16
20
  export function init(app: FlinkApp<any>, options: GenericAuthPluginOptions) {
17
21
  if (options.enableUserCreation == null) options.enableUserCreation = true;
@@ -110,7 +114,14 @@ export function init(app: FlinkApp<any>, options: GenericAuthPluginOptions) {
110
114
  app.expressApp?.get(
111
115
  options.baseUrl + "/password/reset/form/script.js",
112
116
  (req, res) => {
113
- resetPasswordFormScript(req, res, { completeUrl: options.baseUrl + "/password/reset/complete", });
117
+ resetPasswordFormScript(req, res, { completeUrl: options.baseUrl + "/password/reset/complete"});
118
+ }
119
+ );
120
+
121
+ app.expressApp?.get(
122
+ options.baseUrl + "/password/reset/form/style.css",
123
+ (req, res) => {
124
+ resetPasswordFormCss(res);
114
125
  }
115
126
  );
116
127
  }