@adminforth/open-signup 1.2.17 → 1.2.19

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.
@@ -0,0 +1,21 @@
1
+ import { AdminForthPlugin } from "adminforth";
2
+ import type { IAdminForth, IHttpServer, AdminForthResourceColumn, AdminForthResource, HttpExtra } from "adminforth";
3
+ import type { PluginOptions } from './types.js';
4
+ export default class OpenSignupPlugin extends AdminForthPlugin {
5
+ options: PluginOptions;
6
+ emailField: AdminForthResourceColumn;
7
+ passwordField: AdminForthResourceColumn;
8
+ authResource: AdminForthResource;
9
+ emailConfirmedField?: AdminForthResourceColumn;
10
+ adminforth: IAdminForth;
11
+ constructor(options: PluginOptions);
12
+ modifyResourceConfig(adminforth: IAdminForth, resourceConfig: AdminForthResource): Promise<void>;
13
+ validateConfigAfterDiscover(adminforth: IAdminForth, resourceConfig: AdminForthResource): void;
14
+ instanceUniqueRepresentation(pluginOptions: any): string;
15
+ doLogin(email: string, response: any, extra: HttpExtra): Promise<{
16
+ error?: string;
17
+ allowedLogin: boolean;
18
+ redirectTo?: string;
19
+ }>;
20
+ setupEndpoints(server: IHttpServer): void;
21
+ }
@@ -0,0 +1,57 @@
1
+ import { EmailAdapter } from 'adminforth';
2
+ import { type PluginsCommonOptions } from "adminforth";
3
+ export interface PluginOptions extends PluginsCommonOptions {
4
+ /**
5
+ * Field name in auth resource which contains email
6
+ */
7
+ emailField: string;
8
+ /**
9
+ * To work properly, this plugin requires a virtual password field in auth resource,
10
+ * which will define any constraints which determine the password strength (regex, minLength).
11
+ * When user will enter passowrd, it will be validated against this field constraints
12
+ * If you don't need it in backoffice itself, you can add it and set showIn = []
13
+ */
14
+ passwordField: string;
15
+ /**
16
+ * Non-virtual field name in auth resource which contains password hash
17
+ */
18
+ passwordHashField: string;
19
+ /**
20
+ * Default which will be assigned to user by default
21
+ * e.g. can be used to set default role
22
+ */
23
+ defaultFieldValues?: {
24
+ [key: string]: any;
25
+ };
26
+ /**
27
+ * If not set user will not be asked for email confirmation (might be dangerous)
28
+ */
29
+ confirmEmails?: {
30
+ /**
31
+ * A boolean field in auth resource which will be set to true when email is confirmed.
32
+ * Must have boolean type.
33
+ */
34
+ emailConfirmedField: string;
35
+ /**
36
+ * From which email to send password reset emails
37
+ * e.g. no-reply@example.com
38
+ * Example.com must be allowed in provider to send emails
39
+ */
40
+ sendFrom: string;
41
+ /**
42
+ * Adapter to send emails
43
+ */
44
+ adapter: EmailAdapter;
45
+ };
46
+ /**
47
+ * Hooks to be executed before and after user is created
48
+ */
49
+ hooks?: {
50
+ beforeUserSave?: any;
51
+ afterUserSave?: any;
52
+ };
53
+ /**
54
+ * Signup component order inder login button
55
+ */
56
+ loginPageComponentOrder?: number;
57
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/open-signup",
3
- "version": "1.2.17",
3
+ "version": "1.2.19",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -26,11 +26,11 @@
26
26
  "@aws-sdk/client-ses": "^3.654.0"
27
27
  },
28
28
  "peerDependencies": {
29
- "adminforth": "2.71.1"
29
+ "adminforth": "3.0.1"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "^22.10.7",
33
- "adminforth": "2.71.1",
33
+ "adminforth": "3.0.1",
34
34
  "semantic-release": "^24.2.1",
35
35
  "semantic-release-slack-bot": "^4.0.2",
36
36
  "typescript": "^5.7.3"
package/tsconfig.json CHANGED
@@ -2,6 +2,7 @@
2
2
  "compilerOptions": {
3
3
  "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include*/
4
4
  "module": "node16", /* Specify what module code is generated. */
5
+ "declaration": true,
5
6
  "outDir": "./dist", /* Specify an output folder for all emitted files. */
6
7
  "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. */
7
8
  "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */