mirror of
https://github.com/documenso/documenso.git
synced 2026-07-26 09:54:51 +10:00
feat: remove default personal orgs from custom sso (#2741)
This commit is contained in:
@@ -60,13 +60,27 @@ export const createUser = async ({ name, email, password, signature }: CreateUse
|
||||
return user;
|
||||
};
|
||||
|
||||
export type OnCreateUserHookOptions = {
|
||||
/**
|
||||
* When true, do not create a "Personal Organisation" for the new user.
|
||||
* Used by the Organisation SSO signup path, where the user is intended
|
||||
* to operate inside the SSO organisation rather than a personal space.
|
||||
*
|
||||
* Defaults to false — preserves the historical behaviour of creating a
|
||||
* personal organisation for every new user.
|
||||
*/
|
||||
skipPersonalOrganisation?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Should be run after a user is created, example during email password signup or google sign in.
|
||||
*
|
||||
* @returns User
|
||||
*/
|
||||
export const onCreateUserHook = async (user: User) => {
|
||||
await createPersonalOrganisation({ userId: user.id });
|
||||
export const onCreateUserHook = async (user: User, options: OnCreateUserHookOptions = {}) => {
|
||||
if (!options.skipPersonalOrganisation) {
|
||||
await createPersonalOrganisation({ userId: user.id });
|
||||
}
|
||||
|
||||
return user;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user