Ask AI
Skip to main content

Create user

Function: Create user

This action allows you to create new user accounts in your application's built-in user database. It's perfect for setting up new users, whether they are customers, employees, or administrators, and configuring their initial access and security settings.

Input

  • Firstname (Text, Optional): The first name of the user you want to create.
  • Lastname (Text, Optional): The last name of the user you want to create.
  • Email (Email Address, Required): The unique email address for the new user. This will be their primary identifier.
  • Password (Password, Required): The password for the new user's account. This must meet your application's password strength requirements.
  • Email verification (True/False, Required, Default: True): Set to True if the user needs to verify their email address before they can fully access their account. Set to False to skip email verification.
  • Trigger email validation (True/False, Required, Default: True): If "Email verification" is True, this setting determines when the verification email is sent. Set to True to send it immediately upon user creation. Set to False to wait until the user attempts to log in for the first time.
  • OTP (True/False, Required, Default: True): Set to True if the user should be prompted to set up One-Time Password (OTP) or Multi-Factor Authentication (MFA) for enhanced security. Set to False to disable this requirement.

Output

  • User variable name (User Object): This variable will store the details of the newly created user if the action is successful. By default, this variable is named CREATED_USER.
  • The status (Status Text): This variable will provide an update on the outcome of the user creation attempt. By default, this variable is named USER_CREATION_STATUS. Possible values include:
    • SUCCESS: The user account was created successfully.
    • USER_EXISTS: A user with the provided email address already exists in the database.
    • PASSWORD_INVALID: The password provided did not meet the required security standards (e.g., too short, missing special characters).
    • UNKNOWN_ERROR: An unexpected issue occurred during the creation process.

Execution Flow

Real-Life Examples

Example 1: Creating a New Customer Account

Imagine you have a sign-up form on your website. After a user fills out their details, you want to create their account.

  • Inputs:
    • Firstname: John
    • Lastname: Doe
    • Email: [email protected]
    • Password: SecureP@ssw0rd123
    • Email verification: True (Default)
    • Trigger email validation: True (Default)
    • OTP: True (Default)
  • Result: A new user account for John Doe is created. The CREATED_USER variable will contain John's user information, and the USER_CREATION_STATUS variable will be SUCCESS. An email verification link is sent to [email protected].

Example 2: Handling an Existing User Registration

A user tries to sign up with an email address that is already registered in your system.

  • Inputs:
    • Firstname: Jane
    • Lastname: Smith
    • Email: [email protected] (This email already exists from Example 1)
    • Password: AnotherP@ssw0rd456
    • Email verification: True (Default)
    • Trigger email validation: True (Default)
    • OTP: True (Default)
  • Result: No new user account is created. The CREATED_USER variable will be empty, and the USER_CREATION_STATUS variable will be USER_EXISTS. You can then display a message to the user, like "An account with this email already exists. Please log in or reset your password."

Example 3: Creating an Internal Admin User Without Immediate Email Validation

You need to create an internal administrator account where email verification isn't needed immediately, and OTP setup can be done later.

  • Inputs:
    • Firstname: Admin
    • Lastname: User
    • Email: [email protected]
    • Password: AdminP@ssw0rd789
    • Email verification: False
    • Trigger email validation: False (This setting is ignored if Email verification is False)
    • OTP: False
  • Result: A new administrator user account is created. The CREATED_USER variable will hold the admin's user data, and the USER_CREATION_STATUS variable will be SUCCESS. This user can log in immediately without email verification and will not be prompted for OTP setup.