@flink-app/generic-auth-plugin 0.11.19 → 0.12.1-alpha.1

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.
Files changed (42) hide show
  1. package/.flink/generatedHandlers.ts +1 -1
  2. package/.flink/generatedJobs.ts +1 -1
  3. package/.flink/generatedRepos.ts +1 -1
  4. package/.flink/schemas/schemas.json +2 -4
  5. package/.flink/schemas/schemas.ts +1 -1
  6. package/.flink/start.ts +1 -1
  7. package/dist/.flink/generatedHandlers.js +1 -1
  8. package/dist/.flink/generatedJobs.js +1 -1
  9. package/dist/.flink/generatedRepos.js +1 -1
  10. package/dist/.flink/schemas/schemas.json +2 -4
  11. package/dist/.flink/start.js +1 -1
  12. package/dist/src/coreFunctions.js +14 -14
  13. package/dist/src/handlers/Management/DeleteUserByUserid.js +21 -23
  14. package/dist/src/handlers/Management/GetSchema.js +12 -14
  15. package/dist/src/handlers/Management/GetUser.js +21 -23
  16. package/dist/src/handlers/Management/GetUserByUserid.js +22 -24
  17. package/dist/src/handlers/Management/GetUserViewByUserid.js +34 -36
  18. package/dist/src/handlers/Management/PutUserPasswordByUserid.js +46 -48
  19. package/dist/src/handlers/Management/PutUserProfileByUserid.js +24 -26
  20. package/dist/src/handlers/Management/PutUserProfileByUseridAppend.js +27 -29
  21. package/dist/src/handlers/Management/PutUserRolesByUserid.js +24 -26
  22. package/dist/src/handlers/Management/PutUserUsernameByUserid.js +33 -35
  23. package/dist/src/handlers/UserCreate.js +44 -46
  24. package/dist/src/handlers/UserLogin.js +23 -25
  25. package/dist/src/handlers/UserLoginByToken.js +23 -25
  26. package/dist/src/handlers/UserPasswordPut.js +21 -23
  27. package/dist/src/handlers/UserPasswordResetComplete.js +27 -29
  28. package/dist/src/handlers/UserPasswordResetForm.js +11 -11
  29. package/dist/src/handlers/UserPasswordResetStart.js +53 -55
  30. package/dist/src/handlers/UserProfileGet.js +21 -23
  31. package/dist/src/handlers/UserProfilePut.js +28 -30
  32. package/dist/src/handlers/UserPushRegisterToken.js +72 -74
  33. package/dist/src/handlers/UserPushRemoveToken.js +25 -27
  34. package/dist/src/handlers/UserToken.js +24 -26
  35. package/dist/src/index.js +7 -8
  36. package/dist/src/init.js +8 -4
  37. package/dist/src/management.js +5 -1
  38. package/dist/src/schemas/User.d.ts +1 -1
  39. package/dist/src/schemas/User.js +0 -1
  40. package/package.json +32 -32
  41. package/src/coreFunctions.ts +34 -59
  42. package/src/schemas/User.ts +8 -8
@@ -25,7 +25,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
25
25
  function verb(n) { return function (v) { return step([n, v]); }; }
26
26
  function step(op) {
27
27
  if (f) throw new TypeError("Generator is already executing.");
28
- while (_) try {
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
29
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
30
  if (y = 0, t) op = [op[0] & 2, t.value];
31
31
  switch (op[0]) {
@@ -49,79 +49,77 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
49
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
50
  exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
51
51
  var flink_1 = require("@flink-app/flink");
52
- var postUserPushRegisterTokenHandler = function (_a) {
53
- var ctx = _a.ctx, req = _a.req, origin = _a.origin;
54
- return __awaiter(void 0, void 0, void 0, function () {
55
- var pluginName, pluginOptions, repo, deregisterOtherDevices, allowMultipleDevices, user, exToken, otherRegistrations, _i, otherRegistrations_1, other, lengthBefore, e_1;
56
- var _b;
57
- return __generator(this, function (_c) {
58
- switch (_c.label) {
59
- case 0:
60
- pluginName = origin || "genericAuthPlugin";
61
- pluginOptions = ctx.plugins[pluginName];
62
- repo = ctx.repos[pluginOptions.repoName];
63
- deregisterOtherDevices = pluginOptions.deregisterOtherDevices || false;
64
- allowMultipleDevices = (_b = pluginOptions.allowMultipleDevices) !== null && _b !== void 0 ? _b : true;
65
- return [4 /*yield*/, repo.getById(req.user._id)];
66
- case 1:
67
- user = _c.sent();
68
- if (user == null) {
69
- return [2 /*return*/, flink_1.notFound("User not found")];
70
- }
71
- exToken = user.pushNotificationTokens.find(function (t) { return t.deviceId == req.body.deviceId; });
72
- if (exToken != null) {
73
- exToken.token = req.body.token;
74
- exToken.type = req.body.type || "firebase";
75
- }
76
- else {
77
- user.pushNotificationTokens.push(__assign(__assign({}, req.body), { type: req.body.type || "firebase" }));
78
- }
79
- if (!allowMultipleDevices) {
80
- // Filter out all other devices except the newly registered one
81
- user.pushNotificationTokens = user.pushNotificationTokens.filter(function (t) { return t.deviceId === req.body.deviceId; });
82
- }
83
- return [4 /*yield*/, repo.updateOne(user._id, {
84
- pushNotificationTokens: user.pushNotificationTokens,
85
- })];
86
- case 2:
87
- _c.sent();
88
- if (!deregisterOtherDevices) return [3 /*break*/, 9];
89
- return [4 /*yield*/, repo.findAll({
90
- $or: [{ "pushNotificationTokens.deviceId": req.body.deviceId }, { "pushNotificationTokens.token": req.body.token }],
91
- _id: { $ne: user._id },
92
- })];
93
- case 3:
94
- otherRegistrations = _c.sent();
95
- flink_1.log.debug("Found " + otherRegistrations.length + " other registrations for device " + req.body.deviceId + " or token " + req.body.token);
96
- _i = 0, otherRegistrations_1 = otherRegistrations;
97
- _c.label = 4;
98
- case 4:
99
- if (!(_i < otherRegistrations_1.length)) return [3 /*break*/, 9];
100
- other = otherRegistrations_1[_i];
101
- _c.label = 5;
102
- case 5:
103
- _c.trys.push([5, 7, , 8]);
104
- lengthBefore = other.pushNotificationTokens.length;
105
- other.pushNotificationTokens = other.pushNotificationTokens.filter(function (t) { return t.deviceId !== req.body.deviceId && t.token !== req.body.token; });
106
- flink_1.log.debug("Deregistering " + (lengthBefore - other.pushNotificationTokens.length) + " devices for user " + other._id + " as other user " + user._id + " claimed this device");
107
- return [4 /*yield*/, repo.updateOne(other._id, {
108
- pushNotificationTokens: other.pushNotificationTokens,
109
- })];
110
- case 6:
111
- _c.sent();
112
- return [3 /*break*/, 8];
113
- case 7:
114
- e_1 = _c.sent();
115
- console.error("Error deregistering other devices", e_1);
116
- return [3 /*break*/, 8];
117
- case 8:
118
- _i++;
119
- return [3 /*break*/, 4];
120
- case 9: return [2 /*return*/, { data: { status: "success" } }];
121
- }
122
- });
52
+ var postUserPushRegisterTokenHandler = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
53
+ var pluginName, pluginOptions, repo, deregisterOtherDevices, allowMultipleDevices, user, exToken, otherRegistrations, _i, otherRegistrations_1, other, lengthBefore, e_1;
54
+ var _c;
55
+ var ctx = _b.ctx, req = _b.req, origin = _b.origin;
56
+ return __generator(this, function (_d) {
57
+ switch (_d.label) {
58
+ case 0:
59
+ pluginName = origin || "genericAuthPlugin";
60
+ pluginOptions = ctx.plugins[pluginName];
61
+ repo = ctx.repos[pluginOptions.repoName];
62
+ deregisterOtherDevices = pluginOptions.deregisterOtherDevices || false;
63
+ allowMultipleDevices = (_c = pluginOptions.allowMultipleDevices) !== null && _c !== void 0 ? _c : true;
64
+ return [4 /*yield*/, repo.getById(req.user._id)];
65
+ case 1:
66
+ user = _d.sent();
67
+ if (user == null) {
68
+ return [2 /*return*/, (0, flink_1.notFound)("User not found")];
69
+ }
70
+ exToken = user.pushNotificationTokens.find(function (t) { return t.deviceId == req.body.deviceId; });
71
+ if (exToken != null) {
72
+ exToken.token = req.body.token;
73
+ exToken.type = req.body.type || "firebase";
74
+ }
75
+ else {
76
+ user.pushNotificationTokens.push(__assign(__assign({}, req.body), { type: req.body.type || "firebase" }));
77
+ }
78
+ if (!allowMultipleDevices) {
79
+ // Filter out all other devices except the newly registered one
80
+ user.pushNotificationTokens = user.pushNotificationTokens.filter(function (t) { return t.deviceId === req.body.deviceId; });
81
+ }
82
+ return [4 /*yield*/, repo.updateOne(user._id, {
83
+ pushNotificationTokens: user.pushNotificationTokens,
84
+ })];
85
+ case 2:
86
+ _d.sent();
87
+ if (!deregisterOtherDevices) return [3 /*break*/, 9];
88
+ return [4 /*yield*/, repo.findAll({
89
+ $or: [{ "pushNotificationTokens.deviceId": req.body.deviceId }, { "pushNotificationTokens.token": req.body.token }],
90
+ _id: { $ne: user._id },
91
+ })];
92
+ case 3:
93
+ otherRegistrations = _d.sent();
94
+ flink_1.log.debug("Found ".concat(otherRegistrations.length, " other registrations for device ").concat(req.body.deviceId, " or token ").concat(req.body.token));
95
+ _i = 0, otherRegistrations_1 = otherRegistrations;
96
+ _d.label = 4;
97
+ case 4:
98
+ if (!(_i < otherRegistrations_1.length)) return [3 /*break*/, 9];
99
+ other = otherRegistrations_1[_i];
100
+ _d.label = 5;
101
+ case 5:
102
+ _d.trys.push([5, 7, , 8]);
103
+ lengthBefore = other.pushNotificationTokens.length;
104
+ other.pushNotificationTokens = other.pushNotificationTokens.filter(function (t) { return t.deviceId !== req.body.deviceId && t.token !== req.body.token; });
105
+ flink_1.log.debug("Deregistering ".concat(lengthBefore - other.pushNotificationTokens.length, " devices for user ").concat(other._id, " as other user ").concat(user._id, " claimed this device"));
106
+ return [4 /*yield*/, repo.updateOne(other._id, {
107
+ pushNotificationTokens: other.pushNotificationTokens,
108
+ })];
109
+ case 6:
110
+ _d.sent();
111
+ return [3 /*break*/, 8];
112
+ case 7:
113
+ e_1 = _d.sent();
114
+ console.error("Error deregistering other devices", e_1);
115
+ return [3 /*break*/, 8];
116
+ case 8:
117
+ _i++;
118
+ return [3 /*break*/, 4];
119
+ case 9: return [2 /*return*/, { data: { status: "success" } }];
120
+ }
123
121
  });
124
- };
122
+ }); };
125
123
  exports.default = postUserPushRegisterTokenHandler;
126
124
  exports.__assumedHttpMethod = "", exports.__file = "UserPushRegisterToken.ts", exports.__query = [], exports.__params = [];
127
- exports.__schemas = { reqSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "deviceId": { "type": "string" }, "token": { "type": "string" }, "platform": { "type": "string", "enum": ["ios", "android", "web"] }, "type": { "type": "string", "enum": ["firebase", "apn-voip"], "description": "The type of the token. This is used to determine which push notification service to use. Default is \"firebase\"" } }, "required": ["deviceId", "token"], "definitions": {} }, resSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "status": { "type": "string", "enum": ["success", "failed"] } }, "required": ["status"], "definitions": {} } };
125
+ exports.__schemas = { reqSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "deviceId": { "type": "string" }, "token": { "type": "string" }, "platform": { "type": "string", "enum": ["ios", "android", "web"] }, "type": { "type": "string", "enum": ["firebase", "apn-voip"] } }, "required": ["deviceId", "token"], "definitions": {} }, resSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "status": { "type": "string", "enum": ["success", "failed"] } }, "required": ["status"], "definitions": {} } };
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
18
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
@@ -38,32 +38,30 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
40
40
  var flink_1 = require("@flink-app/flink");
41
- var postUserRemoveTokenHandler = function (_a) {
42
- var ctx = _a.ctx, req = _a.req, origin = _a.origin;
43
- return __awaiter(void 0, void 0, void 0, function () {
44
- var pluginName, repo, user;
45
- return __generator(this, function (_b) {
46
- switch (_b.label) {
47
- case 0:
48
- pluginName = origin || "genericAuthPlugin";
49
- repo = ctx.repos[ctx.plugins[pluginName].repoName];
50
- return [4 /*yield*/, repo.getById(req.user._id)];
51
- case 1:
52
- user = _b.sent();
53
- if (user == null) {
54
- return [2 /*return*/, flink_1.notFound("User not found")];
55
- }
56
- user.pushNotificationTokens = user.pushNotificationTokens.filter(function (t) { return t.deviceId != req.body.deviceId; });
57
- return [4 /*yield*/, repo.updateOne(user._id, {
58
- pushNotificationTokens: user.pushNotificationTokens,
59
- })];
60
- case 2:
61
- _b.sent();
62
- return [2 /*return*/, { data: { status: "success" } }];
63
- }
64
- });
41
+ var postUserRemoveTokenHandler = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
42
+ var pluginName, repo, user;
43
+ var ctx = _b.ctx, req = _b.req, origin = _b.origin;
44
+ return __generator(this, function (_c) {
45
+ switch (_c.label) {
46
+ case 0:
47
+ pluginName = origin || "genericAuthPlugin";
48
+ repo = ctx.repos[ctx.plugins[pluginName].repoName];
49
+ return [4 /*yield*/, repo.getById(req.user._id)];
50
+ case 1:
51
+ user = _c.sent();
52
+ if (user == null) {
53
+ return [2 /*return*/, (0, flink_1.notFound)("User not found")];
54
+ }
55
+ user.pushNotificationTokens = user.pushNotificationTokens.filter(function (t) { return t.deviceId != req.body.deviceId; });
56
+ return [4 /*yield*/, repo.updateOne(user._id, {
57
+ pushNotificationTokens: user.pushNotificationTokens,
58
+ })];
59
+ case 2:
60
+ _c.sent();
61
+ return [2 /*return*/, { data: { status: "success" } }];
62
+ }
65
63
  });
66
- };
64
+ }); };
67
65
  exports.default = postUserRemoveTokenHandler;
68
66
  exports.__assumedHttpMethod = "", exports.__file = "UserPushRemoveToken.ts", exports.__query = [], exports.__params = [];
69
- exports.__schemas = { reqSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "deviceId": { "type": "string" }, "token": { "type": "string" }, "platform": { "type": "string", "enum": ["ios", "android", "web"] }, "type": { "type": "string", "enum": ["firebase", "apn-voip"], "description": "The type of the token. This is used to determine which push notification service to use. Default is \"firebase\"" } }, "required": ["deviceId", "token"], "definitions": {} }, resSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "status": { "type": "string", "enum": ["success", "failed"] } }, "required": ["status"], "definitions": {} } };
67
+ exports.__schemas = { reqSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "deviceId": { "type": "string" }, "token": { "type": "string" }, "platform": { "type": "string", "enum": ["ios", "android", "web"] }, "type": { "type": "string", "enum": ["firebase", "apn-voip"] } }, "required": ["deviceId", "token"], "definitions": {} }, resSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "status": { "type": "string", "enum": ["success", "failed"] } }, "required": ["status"], "definitions": {} } };
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
18
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
@@ -38,32 +38,30 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
40
40
  var flink_1 = require("@flink-app/flink");
41
- var getUserTokenHandler = function (_a) {
42
- var ctx = _a.ctx, req = _a.req, origin = _a.origin;
43
- return __awaiter(void 0, void 0, void 0, function () {
44
- var pluginName, repo, user, token;
45
- return __generator(this, function (_b) {
46
- switch (_b.label) {
47
- case 0:
48
- pluginName = origin || "genericAuthPlugin";
49
- repo = ctx.repos[ctx.plugins[pluginName].repoName];
50
- return [4 /*yield*/, repo.getById(req.user._id)];
51
- case 1:
52
- user = _b.sent();
53
- if (user == null) {
54
- return [2 /*return*/, flink_1.notFound("User not found")];
55
- }
56
- if (ctx.auth == null) {
57
- return [2 /*return*/, flink_1.internalServerError()];
58
- }
59
- return [4 /*yield*/, ctx.auth.createToken({ username: user.username.toLowerCase(), _id: user._id }, user.roles)];
60
- case 2:
61
- token = _b.sent();
62
- return [2 /*return*/, { data: { token: token } }];
63
- }
64
- });
41
+ var getUserTokenHandler = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
42
+ var pluginName, repo, user, token;
43
+ var ctx = _b.ctx, req = _b.req, origin = _b.origin;
44
+ return __generator(this, function (_c) {
45
+ switch (_c.label) {
46
+ case 0:
47
+ pluginName = origin || "genericAuthPlugin";
48
+ repo = ctx.repos[ctx.plugins[pluginName].repoName];
49
+ return [4 /*yield*/, repo.getById(req.user._id)];
50
+ case 1:
51
+ user = _c.sent();
52
+ if (user == null) {
53
+ return [2 /*return*/, (0, flink_1.notFound)("User not found")];
54
+ }
55
+ if (ctx.auth == null) {
56
+ return [2 /*return*/, (0, flink_1.internalServerError)()];
57
+ }
58
+ return [4 /*yield*/, ctx.auth.createToken({ username: user.username.toLowerCase(), _id: user._id }, user.roles)];
59
+ case 2:
60
+ token = _c.sent();
61
+ return [2 /*return*/, { data: { token: token } }];
62
+ }
65
63
  });
66
- };
64
+ }); };
67
65
  exports.default = getUserTokenHandler;
68
66
  exports.__assumedHttpMethod = "", exports.__file = "UserToken.ts", exports.__query = [], exports.__params = [];
69
67
  exports.__schemas = { reqSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "token": { "type": "string" } }, "required": ["token"], "definitions": {} }, resSchema: undefined };
package/dist/src/index.js CHANGED
@@ -12,7 +12,11 @@ var __assign = (this && this.__assign) || function () {
12
12
  };
13
13
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
14
  if (k2 === undefined) k2 = k;
15
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
16
20
  }) : (function(o, m, k, k2) {
17
21
  if (k2 === undefined) k2 = k;
18
22
  o[k2] = m[k];
@@ -46,13 +50,8 @@ var genericAuthPlugin = function (options) {
46
50
  var sms = options.sms, usernameFormat = options.usernameFormat, restOptions = __rest(options, ["sms", "usernameFormat"]);
47
51
  return {
48
52
  id: options.pluginId,
49
- init: function (app) { return init_1.init(app, options); },
50
- ctx: __assign(__assign({}, restOptions), { loginUser: coreFunctions_1.loginUser,
51
- loginByToken: coreFunctions_1.loginByToken,
52
- createUser: coreFunctions_1.createUser,
53
- changePassword: coreFunctions_1.changePassword,
54
- passwordResetStart: coreFunctions_1.passwordResetStart,
55
- passwordResetComplete: coreFunctions_1.passwordResetComplete, usernameFormat: usernameFormat || /.{1,}$/, smsOptions: sms }),
53
+ init: function (app) { return (0, init_1.init)(app, options); },
54
+ ctx: __assign(__assign({}, restOptions), { loginUser: coreFunctions_1.loginUser, loginByToken: coreFunctions_1.loginByToken, createUser: coreFunctions_1.createUser, changePassword: coreFunctions_1.changePassword, passwordResetStart: coreFunctions_1.passwordResetStart, passwordResetComplete: coreFunctions_1.passwordResetComplete, usernameFormat: usernameFormat || /.{1,}$/, smsOptions: sms }),
56
55
  };
57
56
  };
58
57
  exports.genericAuthPlugin = genericAuthPlugin;
package/dist/src/init.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -118,16 +122,16 @@ function init(app, options) {
118
122
  if ((_a = options.passwordResetSettings) === null || _a === void 0 ? void 0 : _a.enablePasswordResetForm) {
119
123
  (_b = app.expressApp) === null || _b === void 0 ? void 0 : _b.get(options.baseUrl + "/password/reset/form", function (req, res) {
120
124
  var _a;
121
- return UserPasswordResetForm_1.handleUserPasswordResetForm(req, res, {
125
+ return (0, UserPasswordResetForm_1.handleUserPasswordResetForm)(req, res, {
122
126
  templateFile: (_a = options.passwordResetSettings) === null || _a === void 0 ? void 0 : _a.passwordResetForm,
123
127
  completeUrl: options.baseUrl + "/password/reset/complete",
124
128
  });
125
129
  });
126
130
  (_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" });
131
+ (0, UserPasswordResetForm_1.resetPasswordFormScript)(req, res, { completeUrl: options.baseUrl + "/password/reset/complete" });
128
132
  });
129
133
  (_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);
134
+ (0, UserPasswordResetForm_1.resetPasswordFormCss)(res);
131
135
  });
132
136
  }
133
137
  }
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -5,7 +5,7 @@ export interface User {
5
5
  username: string;
6
6
  password?: string;
7
7
  salt?: string;
8
- pwdResetStartedAt?: string;
8
+ pwdResetStartedAt?: string | null;
9
9
  roles: string[];
10
10
  authentificationMethod: "password" | "sms";
11
11
  profile: UserProfile;
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- ;
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
1
  {
2
- "name": "@flink-app/generic-auth-plugin",
3
- "version": "0.11.19",
4
- "description": "Flink plugin that provides a generic user authentification solution.",
5
- "scripts": {
6
- "test": "echo \"Error: no test specified\"",
7
- "build": "flink build",
8
- "prepublish": "npm run build",
9
- "watch": "nodemon --exec \"flink build\""
10
- },
11
- "author": "johan@frost.se",
12
- "publishConfig": {
13
- "access": "public"
14
- },
15
- "license": "MIT",
16
- "types": "dist/src/index.d.ts",
17
- "main": "dist/src/index.js",
18
- "dependencies": {
19
- "@flink-app/email-plugin": "^0.11.14",
20
- "@flink-app/jwt-auth-plugin": "^0.11.14",
21
- "@flink-app/management-api-plugin": "^0.11.14",
22
- "@flink-app/sms-plugin": "^0.11.14",
23
- "handlebars": "^4.7.7",
24
- "jsonwebtoken": "^8.5.1"
25
- },
26
- "devDependencies": {
27
- "@flink-app/flink": "^0.11.14",
28
- "@types/jsonwebtoken": "^8.5.2",
29
- "@types/node": "^15.6.2",
30
- "ts-node": "^9.1.1",
31
- "typescript": "^4.2.4"
32
- },
33
- "gitHead": "a7530956e3caa0e8e16bf4786ab5eae75c9f6c1d"
2
+ "name": "@flink-app/generic-auth-plugin",
3
+ "version": "0.12.1-alpha.1",
4
+ "description": "Flink plugin that provides a generic user authentification solution.",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\"",
7
+ "build": "flink build",
8
+ "prepublish": "npm run build",
9
+ "watch": "nodemon --exec \"flink build\""
10
+ },
11
+ "author": "johan@frost.se",
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "license": "MIT",
16
+ "types": "dist/src/index.d.ts",
17
+ "main": "dist/src/index.js",
18
+ "dependencies": {
19
+ "@flink-app/email-plugin": "^0.12.1-alpha.1",
20
+ "@flink-app/jwt-auth-plugin": "^0.12.1-alpha.1",
21
+ "@flink-app/management-api-plugin": "^0.12.1-alpha.1",
22
+ "@flink-app/sms-plugin": "^0.12.1-alpha.1",
23
+ "handlebars": "^4.7.7",
24
+ "jsonwebtoken": "^8.5.1"
25
+ },
26
+ "devDependencies": {
27
+ "@flink-app/flink": "^0.12.1-alpha.1",
28
+ "@types/jsonwebtoken": "^8.5.2",
29
+ "@types/node": "22.13.10",
30
+ "ts-node": "^9.1.1",
31
+ "typescript": "5.4.5"
32
+ },
33
+ "gitHead": "040e670be372c0cc47d9c7106bed55780910cf39"
34
34
  }