Skip to content

Commit 3e6b876

Browse files
committed
forward custom subField
1 parent 28e3db4 commit 3e6b876

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "payload-oauth2",
3-
"version": "1.0.17",
3+
"version": "1.0.18",
44
"type": "module",
55
"homepage:": "https://github.com/WilsonLe/payload-oauth2",
66
"repository": "https://github.com/WilsonLe/payload-oauth2",

src/modify-auth-collection.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,20 @@ export const modifyAuthCollection = (
1919
(field) => "name" in field && field.name === subFieldName,
2020
);
2121
if (!existingSubField) {
22-
fields.push({
23-
name: subFieldName,
24-
type: "text",
25-
index: true,
26-
access: {
27-
read: () => true,
28-
create: () => true,
29-
update: () => false,
30-
},
31-
});
22+
if (!!pluginOptions.subField) {
23+
fields.push(pluginOptions.subField);
24+
} else {
25+
fields.push({
26+
name: subFieldName,
27+
type: "text",
28+
index: true,
29+
access: {
30+
read: () => true,
31+
create: () => true,
32+
update: () => false,
33+
},
34+
});
35+
}
3236
}
3337

3438
// add email field if disableLocalStrategy is set

0 commit comments

Comments
 (0)