feat(server): support importing users with password (#11978)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Added support for an optional password field when creating a new user via the user creation form or API.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
forehalo
2025-04-25 03:38:34 +00:00
parent 0da5ef28d6
commit f0e2361e81
3 changed files with 6 additions and 1 deletions

View File

@@ -201,6 +201,9 @@ class CreateUserInput {
@Field(() => String, { nullable: true }) @Field(() => String, { nullable: true })
name?: string; name?: string;
@Field(() => String, { nullable: true })
password?: string;
} }
@InputType() @InputType()
@@ -292,7 +295,7 @@ export class UserManagementResolver {
@Args({ name: 'input', type: () => CreateUserInput }) input: CreateUserInput @Args({ name: 'input', type: () => CreateUserInput }) input: CreateUserInput
) { ) {
const { id } = await this.models.user.create({ const { id } = await this.models.user.create({
email: input.email, ...input,
registered: true, registered: true,
}); });

View File

@@ -340,6 +340,7 @@ input CreateCopilotPromptInput {
input CreateUserInput { input CreateUserInput {
email: String! email: String!
name: String name: String
password: String
} }
type CredentialsRequirementType { type CredentialsRequirementType {

View File

@@ -444,6 +444,7 @@ export interface CreateCopilotPromptInput {
export interface CreateUserInput { export interface CreateUserInput {
email: Scalars['String']['input']; email: Scalars['String']['input'];
name?: InputMaybe<Scalars['String']['input']>; name?: InputMaybe<Scalars['String']['input']>;
password?: InputMaybe<Scalars['String']['input']>;
} }
export interface CredentialsRequirementType { export interface CredentialsRequirementType {