Skip to content

Commit 4937a69

Browse files
Merge pull request #139 from authsmith/fix/session
Fix/session
2 parents e00e9c6 + 79b1a34 commit 4937a69

File tree

18 files changed

+1998
-4557
lines changed

18 files changed

+1998
-4557
lines changed

bun.lock

Lines changed: 558 additions & 0 deletions
Large diffs are not rendered by default.

bun.lockb

-94.7 KB
Binary file not shown.

examples/with-website/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@
8282
},
8383
"pnpm": {
8484
"onlyBuiltDependencies": [
85-
"sharp"
85+
"esbuild",
86+
"sharp",
87+
"unrs-resolver"
8688
]
8789
}
8890
}

examples/with-website/pnpm-lock.yaml

Lines changed: 1212 additions & 1211 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { RscEntryLexicalCell as RscEntryLexicalCell_44fe37237e0ebf4470c9990d8cb7b07e } from '@payloadcms/richtext-lexical/rsc'
22
import { RscEntryLexicalField as RscEntryLexicalField_44fe37237e0ebf4470c9990d8cb7b07e } from '@payloadcms/richtext-lexical/rsc'
3+
import { LexicalDiffComponent as LexicalDiffComponent_44fe37237e0ebf4470c9990d8cb7b07e } from '@payloadcms/richtext-lexical/rsc'
34
import { InlineToolbarFeatureClient as InlineToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
45
import { FixedToolbarFeatureClient as FixedToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
56
import { HeadingFeatureClient as HeadingFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client'
@@ -24,45 +25,29 @@ import { AdminLogin as AdminLogin_5115f22b404cb155f038e47c4517c3b6 } from '@/com
2425
import { AdminLoginView as AdminLoginView_bf7c6dca54131ff687a1b9eeba30da45 } from '@/views/AdminLogin/index'
2526

2627
export const importMap = {
27-
'@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell':
28-
RscEntryLexicalCell_44fe37237e0ebf4470c9990d8cb7b07e,
29-
'@payloadcms/richtext-lexical/rsc#RscEntryLexicalField':
30-
RscEntryLexicalField_44fe37237e0ebf4470c9990d8cb7b07e,
31-
'@payloadcms/richtext-lexical/client#InlineToolbarFeatureClient':
32-
InlineToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
33-
'@payloadcms/richtext-lexical/client#FixedToolbarFeatureClient':
34-
FixedToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
35-
'@payloadcms/richtext-lexical/client#HeadingFeatureClient':
36-
HeadingFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
37-
'@payloadcms/richtext-lexical/client#ParagraphFeatureClient':
38-
ParagraphFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
39-
'@payloadcms/richtext-lexical/client#UnderlineFeatureClient':
40-
UnderlineFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
41-
'@payloadcms/richtext-lexical/client#BoldFeatureClient':
42-
BoldFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
43-
'@payloadcms/richtext-lexical/client#ItalicFeatureClient':
44-
ItalicFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
45-
'@payloadcms/richtext-lexical/client#LinkFeatureClient':
46-
LinkFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
47-
'@payloadcms/plugin-seo/client#OverviewComponent':
48-
OverviewComponent_a8a977ebc872c5d5ea7ee689724c0860,
49-
'@payloadcms/plugin-seo/client#MetaTitleComponent':
50-
MetaTitleComponent_a8a977ebc872c5d5ea7ee689724c0860,
51-
'@payloadcms/plugin-seo/client#MetaImageComponent':
52-
MetaImageComponent_a8a977ebc872c5d5ea7ee689724c0860,
53-
'@payloadcms/plugin-seo/client#MetaDescriptionComponent':
54-
MetaDescriptionComponent_a8a977ebc872c5d5ea7ee689724c0860,
55-
'@payloadcms/plugin-seo/client#PreviewComponent':
56-
PreviewComponent_a8a977ebc872c5d5ea7ee689724c0860,
57-
'@/fields/slug/SlugComponent#SlugComponent': SlugComponent_92cc057d0a2abb4f6cf0307edf59f986,
58-
'@payloadcms/richtext-lexical/client#HorizontalRuleFeatureClient':
59-
HorizontalRuleFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
60-
'@payloadcms/richtext-lexical/client#BlocksFeatureClient':
61-
BlocksFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
62-
'@payloadcms/plugin-search/client#LinkToDoc': LinkToDoc_aead06e4cbf6b2620c5c51c9ab283634,
63-
'@payloadcms/plugin-search/client#ReindexButton': ReindexButton_aead06e4cbf6b2620c5c51c9ab283634,
64-
'@/Header/RowLabel#RowLabel': RowLabel_ec255a65fa6fa8d1faeb09cf35284224,
65-
'@/Footer/RowLabel#RowLabel': RowLabel_1f6ff6ff633e3695d348f4f3c58f1466,
66-
'@/components/AfterLogin/index#AdminLogin': AdminLogin_5115f22b404cb155f038e47c4517c3b6,
67-
'@/views/AdminLogin/index#AdminLoginView': AdminLoginView_bf7c6dca54131ff687a1b9eeba30da45,
28+
"@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell": RscEntryLexicalCell_44fe37237e0ebf4470c9990d8cb7b07e,
29+
"@payloadcms/richtext-lexical/rsc#RscEntryLexicalField": RscEntryLexicalField_44fe37237e0ebf4470c9990d8cb7b07e,
30+
"@payloadcms/richtext-lexical/rsc#LexicalDiffComponent": LexicalDiffComponent_44fe37237e0ebf4470c9990d8cb7b07e,
31+
"@payloadcms/richtext-lexical/client#InlineToolbarFeatureClient": InlineToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
32+
"@payloadcms/richtext-lexical/client#FixedToolbarFeatureClient": FixedToolbarFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
33+
"@payloadcms/richtext-lexical/client#HeadingFeatureClient": HeadingFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
34+
"@payloadcms/richtext-lexical/client#ParagraphFeatureClient": ParagraphFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
35+
"@payloadcms/richtext-lexical/client#UnderlineFeatureClient": UnderlineFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
36+
"@payloadcms/richtext-lexical/client#BoldFeatureClient": BoldFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
37+
"@payloadcms/richtext-lexical/client#ItalicFeatureClient": ItalicFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
38+
"@payloadcms/richtext-lexical/client#LinkFeatureClient": LinkFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
39+
"@payloadcms/plugin-seo/client#OverviewComponent": OverviewComponent_a8a977ebc872c5d5ea7ee689724c0860,
40+
"@payloadcms/plugin-seo/client#MetaTitleComponent": MetaTitleComponent_a8a977ebc872c5d5ea7ee689724c0860,
41+
"@payloadcms/plugin-seo/client#MetaImageComponent": MetaImageComponent_a8a977ebc872c5d5ea7ee689724c0860,
42+
"@payloadcms/plugin-seo/client#MetaDescriptionComponent": MetaDescriptionComponent_a8a977ebc872c5d5ea7ee689724c0860,
43+
"@payloadcms/plugin-seo/client#PreviewComponent": PreviewComponent_a8a977ebc872c5d5ea7ee689724c0860,
44+
"@/fields/slug/SlugComponent#SlugComponent": SlugComponent_92cc057d0a2abb4f6cf0307edf59f986,
45+
"@payloadcms/richtext-lexical/client#HorizontalRuleFeatureClient": HorizontalRuleFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
46+
"@payloadcms/richtext-lexical/client#BlocksFeatureClient": BlocksFeatureClient_e70f5e05f09f93e00b997edb1ef0c864,
47+
"@payloadcms/plugin-search/client#LinkToDoc": LinkToDoc_aead06e4cbf6b2620c5c51c9ab283634,
48+
"@payloadcms/plugin-search/client#ReindexButton": ReindexButton_aead06e4cbf6b2620c5c51c9ab283634,
49+
"@/Header/RowLabel#RowLabel": RowLabel_ec255a65fa6fa8d1faeb09cf35284224,
50+
"@/Footer/RowLabel#RowLabel": RowLabel_1f6ff6ff633e3695d348f4f3c58f1466,
51+
"@/components/AfterLogin/index#AdminLogin": AdminLogin_5115f22b404cb155f038e47c4517c3b6,
52+
"@/views/AdminLogin/index#AdminLoginView": AdminLoginView_bf7c6dca54131ff687a1b9eeba30da45
6853
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { withAccountCollection } from 'payload-auth-plugin/collection'
22
export const AdminAccounts = withAccountCollection(
33
{
4-
slug: 'adminAccounts',
4+
slug: 'accounts',
55
},
6-
'adminUsers',
6+
'users',
77
)

examples/with-website/src/collections/Auth/Admin/Users.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { CollectionConfig } from 'payload'
33
import { deleteLinkedAccounts } from 'payload-auth-plugin/collection/hooks'
44
import { AdminAccounts } from './Accounts'
55
export const AdminUsers: CollectionConfig = {
6-
slug: 'adminUsers',
6+
slug: 'users',
77
access: {
88
admin: authenticated,
99
create: authenticated,

examples/with-website/src/collections/Posts/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export const Posts: CollectionConfig<'posts'> = {
191191
position: 'sidebar',
192192
},
193193
hasMany: true,
194-
relationTo: 'adminUsers',
194+
relationTo: 'users',
195195
},
196196
// This field is only used to populate the user data via the `populateAuthors` hook
197197
// This is because the `user` collection has access control locked to protect user privacy

examples/with-website/src/payload-types.ts

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ export type SupportedTimezones =
6363

6464
export interface Config {
6565
auth: {
66-
adminUsers: AdminUserAuthOperations;
66+
users: UserAuthOperations;
6767
};
6868
blocks: {};
6969
collections: {
7070
pages: Page;
7171
posts: Post;
7272
media: Media;
7373
categories: Category;
74-
adminUsers: AdminUser;
75-
adminAccounts: AdminAccount;
74+
users: User;
75+
accounts: Account;
7676
appUsers: AppUser;
7777
appUserAccounts: AppUserAccount;
7878
redirects: Redirect;
@@ -90,8 +90,8 @@ export interface Config {
9090
posts: PostsSelect<false> | PostsSelect<true>;
9191
media: MediaSelect<false> | MediaSelect<true>;
9292
categories: CategoriesSelect<false> | CategoriesSelect<true>;
93-
adminUsers: AdminUsersSelect<false> | AdminUsersSelect<true>;
94-
adminAccounts: AdminAccountsSelect<false> | AdminAccountsSelect<true>;
93+
users: UsersSelect<false> | UsersSelect<true>;
94+
accounts: AccountsSelect<false> | AccountsSelect<true>;
9595
appUsers: AppUsersSelect<false> | AppUsersSelect<true>;
9696
appUserAccounts: AppUserAccountsSelect<false> | AppUserAccountsSelect<true>;
9797
redirects: RedirectsSelect<false> | RedirectsSelect<true>;
@@ -115,8 +115,8 @@ export interface Config {
115115
footer: FooterSelect<false> | FooterSelect<true>;
116116
};
117117
locale: null;
118-
user: AdminUser & {
119-
collection: 'adminUsers';
118+
user: User & {
119+
collection: 'users';
120120
};
121121
jobs: {
122122
tasks: {
@@ -129,7 +129,7 @@ export interface Config {
129129
workflows: unknown;
130130
};
131131
}
132-
export interface AdminUserAuthOperations {
132+
export interface UserAuthOperations {
133133
forgotPassword: {
134134
email: string;
135135
password: string;
@@ -247,7 +247,7 @@ export interface Post {
247247
description?: string | null;
248248
};
249249
publishedAt?: string | null;
250-
authors?: (string | AdminUser)[] | null;
250+
authors?: (string | User)[] | null;
251251
populatedAuthors?:
252252
| {
253253
id?: string | null;
@@ -375,9 +375,9 @@ export interface Category {
375375
}
376376
/**
377377
* This interface was referenced by `Config`'s JSON-Schema
378-
* via the `definition` "adminUsers".
378+
* via the `definition` "users".
379379
*/
380-
export interface AdminUser {
380+
export interface User {
381381
id: string;
382382
firstName?: string | null;
383383
lastName?: string | null;
@@ -390,6 +390,13 @@ export interface AdminUser {
390390
hash?: string | null;
391391
loginAttempts?: number | null;
392392
lockUntil?: string | null;
393+
sessions?:
394+
| {
395+
id: string;
396+
createdAt?: string | null;
397+
expiresAt: string;
398+
}[]
399+
| null;
393400
password?: string | null;
394401
}
395402
/**
@@ -736,13 +743,13 @@ export interface Form {
736743
}
737744
/**
738745
* This interface was referenced by `Config`'s JSON-Schema
739-
* via the `definition` "adminAccounts".
746+
* via the `definition` "accounts".
740747
*/
741-
export interface AdminAccount {
748+
export interface Account {
742749
id: string;
743750
name?: string | null;
744751
picture?: string | null;
745-
user: string | AdminUser;
752+
user: string | User;
746753
issuerName: string;
747754
scope?: string | null;
748755
sub: string;
@@ -1020,12 +1027,12 @@ export interface PayloadLockedDocument {
10201027
value: string | Category;
10211028
} | null)
10221029
| ({
1023-
relationTo: 'adminUsers';
1024-
value: string | AdminUser;
1030+
relationTo: 'users';
1031+
value: string | User;
10251032
} | null)
10261033
| ({
1027-
relationTo: 'adminAccounts';
1028-
value: string | AdminAccount;
1034+
relationTo: 'accounts';
1035+
value: string | Account;
10291036
} | null)
10301037
| ({
10311038
relationTo: 'appUsers';
@@ -1057,8 +1064,8 @@ export interface PayloadLockedDocument {
10571064
} | null);
10581065
globalSlug?: string | null;
10591066
user: {
1060-
relationTo: 'adminUsers';
1061-
value: string | AdminUser;
1067+
relationTo: 'users';
1068+
value: string | User;
10621069
};
10631070
updatedAt: string;
10641071
createdAt: string;
@@ -1070,8 +1077,8 @@ export interface PayloadLockedDocument {
10701077
export interface PayloadPreference {
10711078
id: string;
10721079
user: {
1073-
relationTo: 'adminUsers';
1074-
value: string | AdminUser;
1080+
relationTo: 'users';
1081+
value: string | User;
10751082
};
10761083
key?: string | null;
10771084
value?:
@@ -1378,9 +1385,9 @@ export interface CategoriesSelect<T extends boolean = true> {
13781385
}
13791386
/**
13801387
* This interface was referenced by `Config`'s JSON-Schema
1381-
* via the `definition` "adminUsers_select".
1388+
* via the `definition` "users_select".
13821389
*/
1383-
export interface AdminUsersSelect<T extends boolean = true> {
1390+
export interface UsersSelect<T extends boolean = true> {
13841391
firstName?: T;
13851392
lastName?: T;
13861393
updatedAt?: T;
@@ -1392,12 +1399,19 @@ export interface AdminUsersSelect<T extends boolean = true> {
13921399
hash?: T;
13931400
loginAttempts?: T;
13941401
lockUntil?: T;
1402+
sessions?:
1403+
| T
1404+
| {
1405+
id?: T;
1406+
createdAt?: T;
1407+
expiresAt?: T;
1408+
};
13951409
}
13961410
/**
13971411
* This interface was referenced by `Config`'s JSON-Schema
1398-
* via the `definition` "adminAccounts_select".
1412+
* via the `definition` "accounts_select".
13991413
*/
1400-
export interface AdminAccountsSelect<T extends boolean = true> {
1414+
export interface AccountsSelect<T extends boolean = true> {
14011415
name?: T;
14021416
picture?: T;
14031417
user?: T;
@@ -1835,7 +1849,7 @@ export interface TaskSchedulePublish {
18351849
value: string | Post;
18361850
} | null);
18371851
global?: string | null;
1838-
user?: (string | null) | AdminUser;
1852+
user?: (string | null) | User;
18391853
};
18401854
output?: unknown;
18411855
}

examples/with-website/src/plugins/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ export const plugins: Plugin[] = [
133133
allowOAuthAutoSignUp: true,
134134
usersCollectionSlug: AdminUsers.slug,
135135
accountsCollectionSlug: AdminAccounts.slug,
136-
successRedirectPath: '/admin/collections/pages?limit=10',
137-
errorRedirectPath: '/admin/auth/signin',
136+
successRedirectPath: '/admin',
137+
errorRedirectPath: '/admin/login',
138138
providers: [
139139
GoogleAuthProvider({
140140
client_id: process.env.GOOGLE_CLIENT_ID as string,

0 commit comments

Comments
 (0)