@nocobase/plugin-auth 1.2.13-alpha → 1.3.0-alpha.20240710084543

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 (107) hide show
  1. package/package.json +2 -2
  2. package/dist/client/AuthProvider.d.ts +0 -10
  3. package/dist/client/authenticator.d.ts +0 -21
  4. package/dist/client/basic/Options.d.ts +0 -10
  5. package/dist/client/basic/SignInForm.d.ts +0 -17
  6. package/dist/client/basic/SignUpForm.d.ts +0 -21
  7. package/dist/client/basic/index.d.ts +0 -11
  8. package/dist/client/index.d.ts +0 -35
  9. package/dist/client/index.js +0 -31
  10. package/dist/client/locale/index.d.ts +0 -10
  11. package/dist/client/pages/AuthLayout.d.ts +0 -13
  12. package/dist/client/pages/SignInPage.d.ts +0 -24
  13. package/dist/client/pages/SignUpPage.d.ts +0 -29
  14. package/dist/client/pages/index.d.ts +0 -11
  15. package/dist/client/settings/Authenticator.d.ts +0 -10
  16. package/dist/client/settings/Options.d.ts +0 -12
  17. package/dist/client/settings/authType.d.ts +0 -24
  18. package/dist/client/settings/schemas/authenticators.d.ts +0 -11
  19. package/dist/externalVersion.js +0 -27
  20. package/dist/index.d.ts +0 -9
  21. package/dist/index.js +0 -49
  22. package/dist/locale/en-US.json +0 -27
  23. package/dist/locale/ko_KR.json +0 -26
  24. package/dist/locale/zh-CN.json +0 -27
  25. package/dist/node_modules/cron/LICENSE +0 -8
  26. package/dist/node_modules/cron/lib/cron.js +0 -1
  27. package/dist/node_modules/cron/lib/job.js +0 -215
  28. package/dist/node_modules/cron/lib/time.js +0 -830
  29. package/dist/node_modules/cron/node_modules/luxon/build/amd/luxon.js +0 -7826
  30. package/dist/node_modules/cron/node_modules/luxon/build/cjs-browser/luxon.js +0 -7824
  31. package/dist/node_modules/cron/node_modules/luxon/build/es6/luxon.js +0 -7217
  32. package/dist/node_modules/cron/node_modules/luxon/build/global/luxon.js +0 -7829
  33. package/dist/node_modules/cron/node_modules/luxon/build/global/luxon.min.js +0 -1
  34. package/dist/node_modules/cron/node_modules/luxon/build/node/luxon.js +0 -6932
  35. package/dist/node_modules/cron/node_modules/luxon/package.json +0 -85
  36. package/dist/node_modules/cron/node_modules/luxon/src/datetime.js +0 -2248
  37. package/dist/node_modules/cron/node_modules/luxon/src/duration.js +0 -948
  38. package/dist/node_modules/cron/node_modules/luxon/src/errors.js +0 -61
  39. package/dist/node_modules/cron/node_modules/luxon/src/impl/conversions.js +0 -161
  40. package/dist/node_modules/cron/node_modules/luxon/src/impl/diff.js +0 -75
  41. package/dist/node_modules/cron/node_modules/luxon/src/impl/digits.js +0 -75
  42. package/dist/node_modules/cron/node_modules/luxon/src/impl/english.js +0 -233
  43. package/dist/node_modules/cron/node_modules/luxon/src/impl/formats.js +0 -176
  44. package/dist/node_modules/cron/node_modules/luxon/src/impl/formatter.js +0 -400
  45. package/dist/node_modules/cron/node_modules/luxon/src/impl/invalid.js +0 -14
  46. package/dist/node_modules/cron/node_modules/luxon/src/impl/locale.js +0 -494
  47. package/dist/node_modules/cron/node_modules/luxon/src/impl/regexParser.js +0 -335
  48. package/dist/node_modules/cron/node_modules/luxon/src/impl/tokenParser.js +0 -444
  49. package/dist/node_modules/cron/node_modules/luxon/src/impl/util.js +0 -274
  50. package/dist/node_modules/cron/node_modules/luxon/src/impl/zoneUtil.js +0 -34
  51. package/dist/node_modules/cron/node_modules/luxon/src/info.js +0 -169
  52. package/dist/node_modules/cron/node_modules/luxon/src/interval.js +0 -637
  53. package/dist/node_modules/cron/node_modules/luxon/src/luxon.js +0 -26
  54. package/dist/node_modules/cron/node_modules/luxon/src/package.json +0 -4
  55. package/dist/node_modules/cron/node_modules/luxon/src/settings.js +0 -148
  56. package/dist/node_modules/cron/node_modules/luxon/src/zone.js +0 -91
  57. package/dist/node_modules/cron/node_modules/luxon/src/zones/IANAZone.js +0 -189
  58. package/dist/node_modules/cron/node_modules/luxon/src/zones/fixedOffsetZone.js +0 -102
  59. package/dist/node_modules/cron/node_modules/luxon/src/zones/invalidZone.js +0 -53
  60. package/dist/node_modules/cron/node_modules/luxon/src/zones/systemZone.js +0 -61
  61. package/dist/node_modules/cron/package.json +0 -1
  62. package/dist/node_modules/cron/types/index.d.ts +0 -181
  63. package/dist/node_modules/cron/types/index.test-d.ts +0 -85
  64. package/dist/preset.d.ts +0 -11
  65. package/dist/preset.js +0 -43
  66. package/dist/server/actions/auth.d.ts +0 -16
  67. package/dist/server/actions/auth.js +0 -50
  68. package/dist/server/actions/authenticators.d.ts +0 -16
  69. package/dist/server/actions/authenticators.js +0 -112
  70. package/dist/server/basic-auth.d.ts +0 -18
  71. package/dist/server/basic-auth.js +0 -192
  72. package/dist/server/collections/authenticators.d.ts +0 -13
  73. package/dist/server/collections/authenticators.js +0 -126
  74. package/dist/server/collections/token-blacklist.d.ts +0 -10
  75. package/dist/server/collections/token-blacklist.js +0 -51
  76. package/dist/server/collections/users-authenticators.d.ts +0 -14
  77. package/dist/server/collections/users-authenticators.js +0 -94
  78. package/dist/server/index.d.ts +0 -11
  79. package/dist/server/index.js +0 -51
  80. package/dist/server/locale/en-US.d.ts +0 -17
  81. package/dist/server/locale/en-US.js +0 -39
  82. package/dist/server/locale/fr-FR.d.ts +0 -17
  83. package/dist/server/locale/fr-FR.js +0 -39
  84. package/dist/server/locale/index.d.ts +0 -11
  85. package/dist/server/locale/index.js +0 -52
  86. package/dist/server/locale/ja-JP.d.ts +0 -13
  87. package/dist/server/locale/ja-JP.js +0 -35
  88. package/dist/server/locale/pt-BR.d.ts +0 -17
  89. package/dist/server/locale/pt-BR.js +0 -39
  90. package/dist/server/locale/zh-CN.d.ts +0 -19
  91. package/dist/server/locale/zh-CN.js +0 -41
  92. package/dist/server/migrations/20230506152253-basic-authenticator.d.ts +0 -14
  93. package/dist/server/migrations/20230506152253-basic-authenticator.js +0 -53
  94. package/dist/server/migrations/20230607174500-update-basic.d.ts +0 -14
  95. package/dist/server/migrations/20230607174500-update-basic.js +0 -56
  96. package/dist/server/migrations/20231218132032-fix-allow-signup.d.ts +0 -14
  97. package/dist/server/migrations/20231218132032-fix-allow-signup.js +0 -64
  98. package/dist/server/model/authenticator.d.ts +0 -17
  99. package/dist/server/model/authenticator.js +0 -78
  100. package/dist/server/plugin.d.ts +0 -19
  101. package/dist/server/plugin.js +0 -138
  102. package/dist/server/storer.d.ts +0 -24
  103. package/dist/server/storer.js +0 -78
  104. package/dist/server/token-blacklist.d.ts +0 -25
  105. package/dist/server/token-blacklist.js +0 -95
  106. package/dist/swagger/index.d.ts +0 -762
  107. package/dist/swagger/index.js +0 -796
@@ -1,181 +0,0 @@
1
- // Type definitions for cron 2.0
2
- // Project: https://www.npmjs.com/package/cron
3
- // Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
4
- // Lundarl Gholoi <https://github.com/winup>
5
- // koooge <https://github.com/koooge>
6
- // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
-
8
- /// <reference types="node" />
9
-
10
- import { SpawnOptions } from 'child_process';
11
- import { DateTime } from 'luxon';
12
-
13
- export declare type CronCommand =
14
- | (() => void)
15
- | string
16
- | {
17
- command: string;
18
- args?: ReadonlyArray<string> | undefined;
19
- options?: SpawnOptions | undefined;
20
- };
21
-
22
- export declare class CronTime {
23
- /**
24
- * Create a new ```CronTime```.
25
- * @param source The time to fire off your job. This can be in the form of cron syntax, a JS ```Date``` object, or a luxon ```DateTime``` object.
26
- * @param zone Timezone name. Can be any string accepted by luxon's ```DateTime.setZone()``` (https://moment.github.io/luxon/api-docs/index.html#datetimesetzone).
27
- * @param utcOffset UTC offset. Don't use both ```zone``` and ```utcOffset``` together or weird things may happen.
28
- */
29
- constructor(
30
- source: string | Date | DateTime,
31
- zone?: string,
32
- utcOffset?: string | number
33
- );
34
-
35
- /**
36
- * Tells you when ```CronTime``` will be run.
37
- */
38
- public sendAt(): DateTime;
39
- /**
40
- * Tells you when ```CronTime``` will be run.
41
- * @param i Indicate which turn of run after now. If not given return next run time.
42
- * @returns A ```DateTime``` when the source passed in the constructor is a ```Date``` or a ```DateTime``` and an array of ```DateTime``` when the source is a string.
43
- */
44
- public sendAt(i?: number): DateTime | DateTime[];
45
- /**
46
- * Get the number of milliseconds in the future at which to fire our callbacks.
47
- */
48
- public getTimeout(): number;
49
- }
50
-
51
- export declare interface CronJobParameters {
52
- /**
53
- * The time to fire off your job. This can be in the form of cron syntax, a JS ```Date``` object, or a luxon ```DateTime``` object.
54
- */
55
- cronTime: string | Date | DateTime;
56
- /**
57
- * The function to fire at the specified time. If an ```onComplete``` callback was provided, ```onTick``` will receive it as an argument. ```onTick``` may call ```onComplete``` when it has finished its work.
58
- */
59
- onTick: CronCommand;
60
- /**
61
- * A function that will fire when the job is stopped with ```job.stop()```, and may also be called by ```onTick``` at the end of each run.
62
- */
63
- onComplete?: CronCommand | null | undefined;
64
- /**
65
- * Specifies whether to start the job just before exiting the constructor. By default this is set to false. If left at default you will need to call ```job.start()``` in order to start the job (assuming ```job``` is the variable you set the cronjob to). This does not immediately fire your ```onTick``` function, it just gives you more control over the behavior of your jobs.
66
- */
67
- start?: boolean | undefined;
68
- /**
69
- * Specify the timezone for the execution. This will modify the actual time relative to your timezone. If the timezone is invalid, an error is thrown. Can be any string accepted by luxon's ```DateTime.setZone()``` (https://moment.github.io/luxon/api-docs/index.html#datetimesetzone). Probably don't use both ```timeZone``` and ```utcOffset``` together or weird things may happen.
70
- */
71
- timeZone?: string | undefined;
72
- /**
73
- * The context within which to execute the onTick method. This defaults to the cronjob itself allowing you to call ```this.stop()```. However, if you change this you'll have access to the functions and values within your context object.
74
- */
75
- context?: any;
76
- /**
77
- * This will immediately fire your ```onTick``` function as soon as the requisit initialization has happened. This option is set to ```false``` by default for backwards compatibility.
78
- */
79
- runOnInit?: boolean | undefined;
80
- /**
81
- * This allows you to specify the offset of your timezone rather than using the ```timeZone``` param. Probably don't use both ```timeZone``` and ```utcOffset``` together or weird things may happen.
82
- */
83
- utcOffset?: string | number | undefined;
84
- /**
85
- * If you have code that keeps the event loop running and want to stop the node process when that finishes regardless of the state of your cronjob, you can do so making use of this parameter. This is off by default and cron will run as if it needs to control the event loop. For more information take a look at [timers#timers_timeout_unref](https://nodejs.org/api/timers.html#timers_timeout_unref) from the NodeJS docs.
86
- */
87
- unrefTimeout?: boolean | undefined;
88
- }
89
-
90
- export declare class CronJob {
91
- /**
92
- * Return ```true``` if job is running.
93
- */
94
- public running: boolean | undefined;
95
- /**
96
- * Function using to fire ```onTick```, default set to an inner private function. Overwrite this only if you have a really good reason to do so.
97
- */
98
- public fireOnTick: Function;
99
-
100
- /**
101
- * Create a new ```CronJob```.
102
- * @param cronTime The time to fire off your job. This can be in the form of cron syntax or a JS ```Date``` object.
103
- * @param onTick The function to fire at the specified time.
104
- * @param onComplete A function that will fire when the job is complete, when it is stopped.
105
- * @param startNow Specifies whether to start the job just before exiting the constructor. By default this is set to false. If left at default you will need to call ```job.start()``` in order to start the job (assuming ```job``` is the variable you set the cronjob to). This does not immediately fire your onTick function, it just gives you more control over the behavior of your jobs.
106
- * @param timeZone Specify the timezone for the execution. This will modify the actual time relative to your timezone. If the timezone is invalid, an error is thrown. Can be any string accepted by luxon's ```DateTime.setZone()``` (https://moment.github.io/luxon/api-docs/index.html#datetimesetzone).
107
- * @param context The context within which to execute the onTick method. This defaults to the cronjob itself allowing you to call ```this.stop()```. However, if you change this you'll have access to the functions and values within your context object.
108
- * @param runOnInit This will immediately fire your ```onTick``` function as soon as the requisit initialization has happened. This option is set to ```false``` by default for backwards compatibility.
109
- * @param utcOffset This allows you to specify the offset of your timezone rather than using the ```timeZone``` param. Probably don't use both ```timeZone``` and ```utcOffset``` together or weird things may happen.
110
- * @param unrefTimeout If you have code that keeps the event loop running and want to stop the node process when that finishes regardless of the state of your cronjob, you can do so making use of this parameter. This is off by default and cron will run as if it needs to control the event loop. For more information take a look at [timers#timers_timeout_unref](https://nodejs.org/api/timers.html#timers_timeout_unref) from the NodeJS docs.
111
- */
112
- constructor(
113
- cronTime: string | Date | DateTime,
114
- onTick: CronCommand,
115
- onComplete?: CronCommand | null,
116
- startNow?: boolean,
117
- timeZone?: string,
118
- context?: any,
119
- runOnInit?: boolean,
120
- utcOffset?: string | number,
121
- unrefTimeout?: boolean
122
- );
123
- /**
124
- * Create a new ```CronJob```.
125
- * @param options Job parameters.
126
- */
127
- constructor(options: CronJobParameters);
128
-
129
- /**
130
- * Runs your job.
131
- */
132
- public start(): void;
133
- /**
134
- * Stops your job.
135
- */
136
- public stop(): void;
137
- /**
138
- * Change the time for the ```CronJob```.
139
- * @param time Target time.
140
- */
141
- public setTime(time: CronTime): void;
142
- /**
143
- * Tells you the last execution date.
144
- */
145
- public lastDate(): Date;
146
- /**
147
- * Tells you when a ```CronTime``` will be run.
148
- */
149
- public nextDate(): DateTime;
150
- public nextDates(): DateTime;
151
- /**
152
- * Tells you when a ```CronTime``` will be run.
153
- * @param i Indicate which turn of run after now. If not given return next run time.
154
- * @returns A `DateTime` when the cronTime passed in the constructor is a `Date` or a `DateTime` and an array of `DateTime` when the cronTime is a string.
155
- */
156
- public nextDates(i?: number): DateTime | DateTime[];
157
- /**
158
- * Add another ```onTick``` function.
159
- * @param callback Target function.
160
- */
161
- public addCallback(callback: Function): void;
162
- }
163
-
164
- export declare function job(options: CronJobParameters): CronJob;
165
- export declare function job(
166
- cronTime: string | Date | DateTime,
167
- onTick: () => void,
168
- onComplete?: CronCommand | null,
169
- start?: boolean,
170
- timeZone?: string,
171
- context?: any,
172
- runOnInit?: boolean,
173
- utcOffset?: string | number,
174
- unrefTimeout?: boolean
175
- ): CronJob;
176
- export declare function time(
177
- source: string | Date | DateTime,
178
- zone?: string
179
- ): CronTime;
180
- export declare function sendAt(cronTime: string | Date | DateTime): DateTime;
181
- export declare function timeout(cronTime: string | Date | DateTime): number;
@@ -1,85 +0,0 @@
1
- import * as luxon from 'luxon';
2
- import { expectType } from 'tsd';
3
- import * as cron from '..';
4
-
5
- const CronJob = cron.CronJob;
6
- const CronTime = cron.CronTime;
7
-
8
- const DateTime = luxon.DateTime;
9
-
10
- const timeZone = 'America/Los_Angeles';
11
-
12
- // basic cron usage
13
- const job = new CronJob(
14
- '* * * * * *',
15
- () => {},
16
- null,
17
- true
18
- );
19
-
20
- // using factory function with parameters object
21
- expectType<cron.CronJob>(cron.job({
22
- cronTime: '00 30 11 * * 1-5',
23
- onTick: () => {},
24
- start: false,
25
- timeZone: 'America/Los_Angeles'
26
- }));
27
-
28
- // with timezone
29
- new CronJob(
30
- '* * * * * *',
31
- () => {},
32
- null,
33
- true,
34
- timeZone
35
- );
36
-
37
- // with onComplete
38
- new CronJob(
39
- '00 30 11 * * 1-5',
40
- () => {},
41
- () => {},
42
- true,
43
- timeZone
44
- );
45
-
46
- // with Date
47
- new CronJob(
48
- new Date(),
49
- () => {},
50
- null,
51
- true,
52
- timeZone
53
- );
54
-
55
- // with Luxon DateTime
56
- new CronJob(
57
- DateTime.local(),
58
- () => {},
59
- null,
60
- true,
61
- timeZone
62
- );
63
-
64
- // with system commands
65
- new CronJob(
66
- '00 30 11 * * 1-5',
67
- 'ls',
68
- { command: 'ls', args: ['./'] },
69
- true,
70
- timeZone
71
- );
72
-
73
- // check function return types
74
- expectType<Date>(job.lastDate());
75
- expectType<luxon.DateTime>(job.nextDates());
76
- expectType<luxon.DateTime | luxon.DateTime[]>(job.nextDates(1));
77
- expectType<boolean | undefined>(job.running);
78
- job.setTime(new CronTime('00 30 11 * * 1-2'));
79
- job.start();
80
- job.stop();
81
-
82
- // check cronTime format
83
- new CronTime('* * * * * *');
84
- new CronTime(new Date());
85
- new CronTime(DateTime.local());
package/dist/preset.d.ts DELETED
@@ -1,11 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- export declare const presetAuthType = "Email/Password";
10
- export declare const presetAuthenticator = "basic";
11
- export declare const namespace: string;
package/dist/preset.js DELETED
@@ -1,43 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name2 in all)
16
- __defProp(target, name2, { get: all[name2], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var preset_exports = {};
28
- __export(preset_exports, {
29
- namespace: () => namespace,
30
- presetAuthType: () => presetAuthType,
31
- presetAuthenticator: () => presetAuthenticator
32
- });
33
- module.exports = __toCommonJS(preset_exports);
34
- var import_package = require("../package.json");
35
- const presetAuthType = "Email/Password";
36
- const presetAuthenticator = "basic";
37
- const namespace = import_package.name;
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- namespace,
41
- presetAuthType,
42
- presetAuthenticator
43
- });
@@ -1,16 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Context, Next } from '@nocobase/actions';
10
- declare const _default: {
11
- lostPassword: (ctx: Context, next: Next) => Promise<void>;
12
- resetPassword: (ctx: Context, next: Next) => Promise<void>;
13
- getUserByResetToken: (ctx: Context, next: Next) => Promise<void>;
14
- changePassword: (ctx: Context, next: Next) => Promise<void>;
15
- };
16
- export default _default;
@@ -1,50 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var auth_exports = {};
28
- __export(auth_exports, {
29
- default: () => auth_default
30
- });
31
- module.exports = __toCommonJS(auth_exports);
32
- /* istanbul ignore file -- @preserve */
33
- var auth_default = {
34
- lostPassword: async (ctx, next) => {
35
- ctx.body = await ctx.auth.lostPassword();
36
- await next();
37
- },
38
- resetPassword: async (ctx, next) => {
39
- ctx.body = await ctx.auth.resetPassword();
40
- await next();
41
- },
42
- getUserByResetToken: async (ctx, next) => {
43
- ctx.body = await ctx.auth.getUserByResetToken();
44
- await next();
45
- },
46
- changePassword: async (ctx, next) => {
47
- ctx.body = await ctx.auth.changePassword();
48
- await next();
49
- }
50
- };
@@ -1,16 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Context, Next } from '@nocobase/actions';
10
- declare const _default: {
11
- listTypes: (ctx: Context, next: Next) => Promise<void>;
12
- publicList: (ctx: Context, next: Next) => Promise<void>;
13
- destroy: (ctx: Context, next: Next) => Promise<void>;
14
- update: (ctx: Context, next: Next) => Promise<void>;
15
- };
16
- export default _default;
@@ -1,112 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var authenticators_exports = {};
28
- __export(authenticators_exports, {
29
- default: () => authenticators_default
30
- });
31
- module.exports = __toCommonJS(authenticators_exports);
32
- var import_preset = require("../../preset");
33
- async function checkCount(repository, id) {
34
- const count = await repository.count({
35
- filter: {
36
- enabled: true,
37
- id: {
38
- $ne: id
39
- }
40
- }
41
- });
42
- if (count <= 0) {
43
- throw new Error("Please keep and enable at least one authenticator");
44
- }
45
- }
46
- var authenticators_default = {
47
- listTypes: async (ctx, next) => {
48
- ctx.body = ctx.app.authManager.listTypes();
49
- await next();
50
- },
51
- publicList: async (ctx, next) => {
52
- const repo = ctx.db.getRepository("authenticators");
53
- const authManager = ctx.app.authManager;
54
- const authenticators = await repo.find({
55
- fields: ["name", "authType", "title", "options", "sort"],
56
- filter: {
57
- enabled: true
58
- },
59
- sort: "sort"
60
- });
61
- ctx.body = authenticators.map((authenticator) => {
62
- var _a;
63
- const authType = authManager.getAuthConfig(authenticator.authType);
64
- return {
65
- name: authenticator.name,
66
- authType: authenticator.authType,
67
- authTypeTitle: (authType == null ? void 0 : authType.title) || "",
68
- title: authenticator.title,
69
- options: ((_a = authenticator.options) == null ? void 0 : _a.public) || {}
70
- };
71
- });
72
- await next();
73
- },
74
- destroy: async (ctx, next) => {
75
- const repository = ctx.db.getRepository("authenticators");
76
- const { filterByTk, filter } = ctx.action.params;
77
- try {
78
- await checkCount(repository, filterByTk);
79
- } catch (err) {
80
- ctx.throw(400, ctx.t(err.message, { ns: import_preset.namespace }));
81
- }
82
- const instance = await repository.destroy({
83
- filter,
84
- filterByTk,
85
- context: ctx
86
- });
87
- ctx.body = instance;
88
- await next();
89
- },
90
- update: async (ctx, next) => {
91
- const repository = ctx.db.getRepository("authenticators");
92
- const { forceUpdate, filterByTk, values, whitelist, blacklist, filter, updateAssociationValues } = ctx.action.params;
93
- if (!values.enabled) {
94
- try {
95
- await checkCount(repository, values.id);
96
- } catch (err) {
97
- ctx.throw(400, ctx.t(err.message, { ns: import_preset.namespace }));
98
- }
99
- }
100
- ctx.body = await repository.update({
101
- filterByTk,
102
- values,
103
- whitelist,
104
- blacklist,
105
- filter,
106
- updateAssociationValues,
107
- context: ctx,
108
- forceUpdate
109
- });
110
- await next();
111
- }
112
- };
@@ -1,18 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { AuthConfig, BaseAuth } from '@nocobase/auth';
10
- export declare class BasicAuth extends BaseAuth {
11
- constructor(config: AuthConfig);
12
- validate(): Promise<any>;
13
- signUp(): Promise<any>;
14
- lostPassword(): Promise<any>;
15
- resetPassword(): Promise<any>;
16
- getUserByResetToken(): Promise<any>;
17
- changePassword(): Promise<any>;
18
- }