Skip to content

Commit ca29802

Browse files
committed
Revert "fix: add unique representation for multiple plugin instances"
This reverts commit 8ec191c.
1 parent 8ec191c commit ca29802

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

dev-demo/resources/users.ts

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ import AdminForthAdapterKeycloakOauth2 from "../../adapters/adminforth-keycloak-
2020
import AdminForthAdapterMicrosoftOauth2 from "../../adapters/adminforth-microsoft-oauth-adapter";
2121
// import AdminForthAdapterTwitchOauth2 from "../../adapters/adminforth-twitch-oauth-adapter";
2222
import { randomUUID } from "crypto";
23-
import EmailInvitePlugin from '../../plugins/adminforth-email-invite';
24-
2523

2624
declare global {
2725
namespace NodeJS {
@@ -56,16 +54,6 @@ export default {
5654

5755
recordLabel: (r: any) => `👤 ${r.email}`,
5856
plugins: [
59-
new EmailInvitePlugin({
60-
emailField: 'email',
61-
passwordField: 'password',
62-
sendFrom: 'noreply@yourapp.com',
63-
adapter: new EmailAdapterAwsSes({
64-
region: 'us-east-1',
65-
accessKeyId:" process.env.AWS_ACCESS_KEY_ID",
66-
secretAccessKey: "process.env.AWS_SECRET_ACCESS_KEY",
67-
}),
68-
}),
6957
// new ForeignInlineListPlugin({
7058
// foreignResourceId: "aparts",
7159
// modifyTableResourceConfig: (resourceConfig: AdminForthResource) => {
@@ -285,7 +273,7 @@ export default {
285273
minLength: 8,
286274
validation: [AdminForth.Utils.PASSWORD_VALIDATORS.UP_LOW_NUM],
287275
type: AdminForthDataTypes.STRING,
288-
showIn: { all: false }, // to show in create and edit pages
276+
showIn: ["create", "edit"], // to show in create and edit pages
289277
masked: true, // to show stars in input field
290278
},
291279
{
@@ -305,20 +293,20 @@ export default {
305293
hooks: {
306294
create: {
307295
beforeSave: async ({ record, adminUser, resource }: any) => {
308-
// record.password_hash = await AdminForth.Utils.generatePasswordHash(
309-
// record.password
310-
// );
296+
record.password_hash = await AdminForth.Utils.generatePasswordHash(
297+
record.password
298+
);
311299
return { ok: true, error: "" };
312300
// if return 'error': , record will not be saved and error will be proxied
313301
},
314302
},
315303
edit: {
316304
beforeSave: async ({ record, adminUser, resource }: any) => {
317-
// if (record.password) {
318-
// record.password_hash = await AdminForth.Utils.generatePasswordHash(
319-
// record.password
320-
// );
321-
// }
305+
if (record.password) {
306+
record.password_hash = await AdminForth.Utils.generatePasswordHash(
307+
record.password
308+
);
309+
}
322310
return { ok: true, error: "" };
323311
},
324312
// beforeDatasourceRequest: async ({ query, adminUser, resource }) => {

0 commit comments

Comments
 (0)