Skip to main content

AdminSignupDTO

Package: @nauth-toolkit/core Type: DTO (Request/Response)

Data transfer objects for admin-initiated user account creation with override capabilities.

import { AdminSignupDTO, AdminSignupResponseDTO } from '@nauth-toolkit/nestjs';

AdminSignupDTO (Request)

PropertyTypeRequiredDescription
emailstringYesUser email address. Valid email format (RFC 5322). Max 255 chars. Trimmed, lowercased.
passwordstringNoUser password. Required unless generatePassword is true. 8-128 characters. Not trimmed.
usernamestringNoOptional username. 3-255 characters. Alphanumeric, underscores, and hyphens only. Trimmed, lowercased.
firstNamestringNoOptional first name. 1-100 characters. Trimmed.
lastNamestringNoOptional last name. 1-100 characters. Trimmed.
phonestringNoOptional phone number. E.164 format with + prefix. Max 20 chars. Example: +14155552671.
metadataRecord<string, unknown>NoOptional custom metadata fields.
isEmailVerifiedbooleanNoBypass email verification requirement. Default: false.
isPhoneVerifiedbooleanNoBypass phone verification requirement. Default: false.
mustChangePasswordbooleanNoForce password change on first login. Default: false.
generatePasswordbooleanNoAuto-generate secure password. Generated password returned in response. Default: false.

AdminSignupResponseDTO (Response)

PropertyTypeDescription
userUserResponseDTOCreated user object (sanitized, excludes sensitive fields).
generatedPasswordstring | undefinedGenerated password (only present if generatePassword was true).

Example

Request:

{
"email": "user@example.com",
"password": "SecurePass123!",
"username": "johndoe",
"firstName": "John",
"lastName": "Doe",
"isEmailVerified": true,
"mustChangePassword": false
}

Response:

{
"user": {
"sub": "a21b654c-2746-4168-acee-c175083a65cd",
"email": "user@example.com",
"username": "johndoe",
"firstName": "John",
"lastName": "Doe",
"isEmailVerified": true,
"isPhoneVerified": false
}
}

Response (with generated password):

{
"user": {
"sub": "a21b654c-2746-4168-acee-c175083a65cd",
"email": "user@example.com",
"username": "johndoe",
"firstName": "John",
"lastName": "Doe",
"isEmailVerified": true,
"isPhoneVerified": false
},
"generatedPassword": "Xk9#mP2$qR7@vN4w"
}

Used By