Skip to Content

User Actions

ActionDescription
Refresh login user dataFetch the latest data for the signed-in user.
Send verification codeSend a six-digit code to a phone number or email address. The code remains valid for five minutes.
Sign upCreate a new user account in the app.
Sign inSign in with a username, phone number, email address, verification code, or SSO provider.
Sign outClear the current user’s local sign-in state.
Bind accountLink the signed-in account to a phone number, email address, or single sign-on (SSO) provider.
Unbind accountUnlink a phone number, email address, or SSO provider from the signed-in account.
Reset passwordVerify identity through a verification code and reset the password.
Delete accountLet a user delete their account after confirming their identity with a verification code or password.

This reference explains when to use each action, how to configure it, and what to expect when it runs.

Refresh login user data

Fetch the latest data for the signed-in user and update the local current-user data source.

Use cases

  • Refresh the interface after a user updates profile information such as their username or avatar.

Parameters

None

Results

None

How it works

  • Process:
    • When triggered, the client starts a data query to the server (operation name zvmAccount).
    • The server extracts the account ID from the request session and uses it as a filter condition to query data from the account table.
    • The queried account data and the user’s permission role list are merged and returned to the frontend.
    • The frontend updates the local “current user” data source with the returned data.
  • Limitations:
    • The action still sends a request when the visitor is signed out. Because the session has no account ID, the server returns an empty object and the client clears the current-user data without showing an error.

Errors

  • Network, server, or permission errors: If the request fails because of connectivity, gateway, rate-limit, or permission issues, Momen keeps the existing current-user data and continues with subsequent actions. It does not show an error automatically.

Examples

Refreshing user profile

  • Goal: Refresh the current-user data after a profile update so the navigation bar displays the new username.

  • Configuration:

    1. Prerequisites:
      • Create a page named Profile and a page named Home.
      • On the Profile page, add an Input component named Username Input and a Button component named Save Button.
      • On the Home page, add a Text component named User username to display the current user’s username.
    2. Select Component: On the Profile page canvas, select the Save Button.
    3. Add Action: In the right panel, open the Action tab and add an action to On click.
    4. Configure Action:
      • In the action selection dropdown, search for and select Update to save the new username to the database first.
      • Click the + button next to the next action slot, search for and select Refresh login user data.
    5. Bind Parameters: None.
  • Outcome: After the username is saved, Refresh login user data updates the local user state and the navigation bar displays the new value.


Send verification code

Generate a six-digit verification code and send it to a phone number or email address. The code remains valid for five minutes.

Use cases

  • Verify a user’s identity during sign-up, sign-in, password reset, account binding, or account deletion.

Parameters

ParameterTypeRequiredDescription
Delivery methodEnumYesChoose the delivery channel: SMS, Email, or Custom.
Custom configObjectNoAppears when Delivery method is Custom. Select a configuration created under Settings → Verification code.
ScenarioEnumYesPurpose of the code: Register, Login, Reset, Bind account, Unbind account, or Deregistration.
Send toTextYesPhone number or email address that receives the code.

Results

  • Result: None
  • On success: Runs after Momen generates and sends the verification code.
  • On failure: Runs when delivery fails because the recipient is missing or invalid, the SMS balance is insufficient, or requests are sent too frequently.

How it works

  • Code generation: Momen generates a six-digit code and stores it with the recipient and selected scenario for five minutes.
  • Delivery:
    • With SMS or Email, Momen sends the code through its built-in delivery service.
    • With Custom, Momen passes Send to, Verification code, and Scenario to the selected Actionflow so it can deliver the code through a third-party provider.
  • Limitations:
    • One-minute cooldown: Requests to the same phone number or email address must be at least one minute apart. Requests made during the cooldown return a rate-limit error.
    • Scenario matching: The scenario used to verify the code must match the scenario used to send it. For example, a code sent for Register cannot be used for Login, even when the digits are correct.

Custom delivery setup

To use the Custom delivery method, complete these steps:

Step 1: Create a send Actionflow

  • Create an Actionflow with three inputs: recipient, verification code, and scenario.
  • Add a node that delivers the code through an API or another channel.
  • Bind the Actionflow inputs to the node parameters.

Step 2: Add Custom config

  • Go to Settings → Verification code, and add a custom configuration.
  • Enter a name, select the Actionflow created in Step 1, and map Send to, Verification code, and Scenario to its inputs under Constant in the data-binding menu.

Step 3: Use Custom config

  • In Send verification code, select the configuration under Custom config. Momen will then deliver codes through the Actionflow.

Errors

  • Automatic error toast: When delivery fails, Momen enters On failure and also displays an error toast, such as Too Many Requests. Avoid adding another toast for the same error unless you want to replace the default feedback.

Examples

Send a verification code during registration

  • Goal: On the registration page, the user enters their phone number and clicks the “Send Code” button to receive a 6-digit SMS verification code.

  • Configuration:

    1. Prerequisites:
      • Create a page named Register.
      • On the Register page, add an Input component named Phone Input and a Button component named Send Code Button.
    2. Select Component: On the Register page canvas, select the Send Code Button.
    3. Add Action: In the right panel, open the Action tab and add an action to On click.
    4. Configure Action:
      • In the action selection dropdown, search for and select Send verification code.
      • Set Delivery method to SMS.
      • Set Scenario to Register.
    5. Bind Parameters:
      • Click the + button next to the Send to parameter.
      • In the data source panel, select Phone Input -> Value.
  • Outcome: The user receives a six-digit SMS code. Triggering the action again during the one-minute cooldown displays a Too Many Requests toast.


Sign up

Create a new user account in the app.

Enable the relevant authentication method under Settings → Sign in before adding this action. The editor only shows sign-up methods that are enabled for the project.

Use cases

  • Let new users create an account with a username, email address, or phone number.

Parameters

ParameterTypeRequiredDescription
MethodEnumYesSign up method: Sign up via username, Sign up via email, or Sign up via phone.

Configure the parameters for the selected sign-up method:

Sign up via username:

ParameterTypeRequiredDescription
UsernameTextYesA unique account name containing only letters or numbers, with a maximum of 32 characters.
PasswordTextYesA password containing at least 8 characters.

Sign up via email:

ParameterTypeRequiredDescription
EmailTextYesUser’s email address.
PasswordTextYesPassword to verify identity during sign in.
Verification codeTextYesThe verification code sent via the “Send verification code” action.

Sign up via phone:

ParameterTypeRequiredDescription
PhoneTextYesUser’s phone number.
Verification codeTextYesThe verification code sent via the “Send verification code” action.
Require passwordBooleanNoWhether the user must set a password.
PasswordTextNoPassword to set when Require password is enabled.

Results

  • Result: None
  • On success: Momen signs in the new user, refreshes the current-user data, and runs the actions in On success.
  • On failure: Momen runs On failure when registration fails because of duplicate credentials, invalid input, or a network error.

How it works

  • Prerequisite: Phone and email sign-up require a code from Send verification code.
  • Process:
    • The client sends the registration details to the server.
    • For phone or email registration, the server validates the verification code against the cached code for the specified scenario.
    • If valid, the server creates a new record in the account table and hashes the password (if provided).
    • After creating the account, the server starts a session and returns the user profile to the client.

Errors

Error CodeError DescriptionTroubleshooting & Solutions
USERNAME_CANNOT_CONTAIN_NONLETTER_OR_NONNUMBERUsername can only contain letters or numbersRemove spaces and special characters.
USERNAME_ALREADY_EXISTSUsername already existsPrompt the user to change the username or guide them to sign in directly.
PASSWORD_TOO_SHORTPassword is too shortRequire at least eight characters.
EMAIL_ADDRESS_ALREADY_EXISTSEmail already existsAsk the user to sign in or reset their password.
PHONE_NUMBER_ALREADY_EXISTSPhone number already existsAsk the user to sign in or use another phone number.
BAD_VERIFICATION_CODEIncorrect verification codeCheck whether the entered verification code is correct or has expired.
INVALID_PHONE_NUMBERInvalid phone numberCheck if the entered phone number format is correct.

Examples

Register with a phone number and verification code

  • Goal: A new user enters their phone number and the received verification code, then clicks the “Register” button to create an account and automatically sign in.

  • Configuration:

    1. Prerequisites:
      • Create a page named Register.
      • On the Register page, add an Input component named Phone Input, an Input component named Code Input, and a Button component named Register Button.
    2. Select Component: On the Register page canvas, select the Register Button.
    3. Add Action: In the right panel, open the Action tab and add an action to On click.
    4. Configure Action:
      • In the action selection dropdown, search for and select Sign up.
      • Set Method to Sign up via phone.
    5. Bind Parameters:
      • Click the + button next to the Phone parameter, and select Phone Input -> Value.
      • Click the + button next to the Verification code parameter, and select Code Input -> Value.
      • Set Require password to false.
  • Outcome: When the user submits a valid phone number and verification code, Momen creates the account and signs the user in.


Sign in

Sign in with a username, phone number, email address, verification code, or SSO provider.

Enable the relevant authentication method under Settings → Sign in before adding this action. The editor only shows sign-in methods that are enabled for the project.

Use cases

  • Require users to sign in before viewing personalized content.
  • Authenticate users before they submit forms or publish content.

Parameters

ParameterTypeRequiredDescription
MethodEnumYesSign-in method: username, phone and password, phone and code, email, or SSO sign-in/sign-up.

Configure the parameters for the selected sign-in method:

Sign in via username:

ParameterTypeRequiredDescription
UsernameTextYesUser’s account name.
PasswordTextYesUser’s password.

Sign in via phone and password:

ParameterTypeRequiredDescription
PhoneTextYesUser’s phone number.
PasswordTextYesUser’s password.

Sign in via phone and code:

ParameterTypeRequiredDescription
PhoneTextYesUser’s phone number.
Verification codeTextYesReceived verification code.

Sign in via email:

ParameterTypeRequiredDescription
EmailTextYesUser’s email address.
PasswordTextYesUser’s password.

SSO sign-in or Sign-up:

ParameterTypeRequiredDescription
SSO accountEnumYesSelect a configured SSO account.
Page typeEnumYesThe type of page to redirect to after successful binding.
Target pageTextYesThe target page to redirect to (appears only when Page type is “App page”).
URLTextYesThe external URL to redirect to (appears only when Page type is “Custom URL”).
Page parametersJSONNoKey-value pairs passed to the target page. Defaults include token and projectid.
Actionflows on successObjectNoActionflow to run after successful authentication.

Results

  • Result: None
  • On success: Runs after authentication succeeds.
  • On failure: Runs when authentication fails, the account does not exist, or a network error occurs.

How it works

  • Process:
    • The client sends the user’s input account identifier and credentials to the backend.
    • The system searches the database for a matching account and compares the password hash or verification code.
    • After verification succeeds, the server returns a session token, which the client stores locally.
    • The client updates the current-user data source and re-renders components that depend on it.

Errors

Error CodeMeaningCauseSolution
USERNAME_CANNOT_CONTAIN_NONLETTER_OR_NONNUMBERUsername can only contain letters or numbersUsername contains special charactersRestrict frontend input to only allow letters and numbers
BAD_VERIFICATION_CODEInvalid verification codeThe code is incorrect or expiredAsk the user to enter the code again or request a new one
INVALID_PHONE_NUMBERInvalid phone numberThe entered phone number does not conform to the standard formatAdd phone number regex validation on the frontend

Examples

Sign in with a username and password

  • Goal: A registered user enters their username and password on the login page and clicks the “Login” button to sign in and access their dashboard.

  • Configuration:

    1. Prerequisites:
      • Create a page named Login and a page named Dashboard.
      • On the Login page, add an Input component named Username Input, an Input component named Password Input, and a Button component named Login Button.
    2. Select Component: On the Login page canvas, select the Login Button.
    3. Add Action: In the right panel, open the Action tab and add an action to On click.
    4. Configure Action:
      • In the action selection dropdown, search for and select Sign in.
      • Set Method to Sign in via username.
    5. Bind Parameters:
      • Click the + button next to the Username parameter, and select Username Input -> Value.
      • Click the + button next to the Password parameter, and select Password Input -> Value.
      • In the On success branch of the action, add a Go to action and set the target page to Dashboard.
  • Outcome: When the user enters their correct username and password and clicks the “Login” button, the system authenticates their credentials, establishes a session, and redirects them to the Dashboard page.


Sign out

Clear the current user’s local sign-in state.

Use cases

  • Add a sign-out button to an account or profile page.
  • Sign out before allowing the user to switch accounts.

Parameters

None

Results

None

How it works

  • Clear local credentials: Momen removes the locally stored session and current-user data.
  • Update dependent UI: Components, variables, and conditions that use the current-user data source update to the guest state.
  • Limitations:
    • Works offline: Sign out clears local state and does not require a network request.
    • Pending requests lose authentication: Requests that finish after sign out no longer have valid credentials and may return 401 Unauthorized. Do not place actions that require authentication after Sign out.

Errors

None

Examples

Sign out from an account page

  • Goal: Let a signed-in user end their session and return to the login page.

  • Configuration:

    1. Prerequisites:
      • Create a page named Personal Center and a page named Login.
      • On the Personal Center page, add a Button component named Sign Out Button.
    2. Select Component: On the Personal Center page canvas, select the Sign Out Button.
    3. Add Action: In the right panel, open the Action tab and add an action to On click.
    4. Configure Action:
      • In the action selection dropdown, search for and select Sign out.
      • Click the + button next to the next action slot, search for and select Go to, and set the target page to Login.
    5. Bind Parameters: None.
  • Outcome: When the user clicks the “Sign Out” button, their local session credentials are deleted, the current user state is reset to guest, and the browser immediately redirects them to the Login page.


Bind account

Link the signed-in account to a phone number, email address, or single sign-on (SSO) provider.

Use cases

  • Add a phone number as a sign-in method or SMS contact.
  • Add an email address as a sign-in method or notification contact.

Parameters

ParameterTypeRequiredDescription
MethodEnumYesBinding method: Bind phone, Bind email, or SSO bind.

Configure the parameters for the selected binding method:

Bind phone:

ParameterTypeRequiredDescription
PhoneTextYesThe phone number to bind.
Verification codeTextYesThe SMS verification code sent to that phone number.

Bind email:

ParameterTypeRequiredDescription
EmailTextYesThe email address to bind.
Verification codeTextYesThe verification code sent to that email.

SSO bind:

ParameterTypeRequiredDescription
SSO configurationEnumYesSelect a configured SSO account.
Page typeEnumYesThe type of page to redirect to after successful binding.
Target pageTextYesThe target page to redirect to (appears only when Page type is “App page”).
URLTextYesThe external URL to redirect to (appears only when Page type is “Custom URL”).
Page parametersJSONNoKey-value pairs passed to the target page. Defaults include token and projectid.
On success actionflowObjectNoActionflow to run after successful binding.

Results

  • Result: Phone and email binding have no direct frontend output. SSO binding redirects the user.
  • On success:
    • Bind phone and Bind email: Runs after binding succeeds. Add Refresh login user data if the page must display the new credential immediately.
    • SSO bind: Redirects to the configured target page and runs the selected On success actionflow.
  • On failure:
    • Bind phone and Bind email: Runs when binding fails, for example because the verification code is invalid or the credential belongs to another account.
    • SSO bind: Does not provide a frontend failure branch.

How it works

  • Bind phone: The server normalizes the number to E.164 format, verifies the SMS code, and links the number to the current account.
  • Bind email: The server verifies the email code and links the address to the current account. This action does not perform strict email-format validation.
  • SSO bind: Momen redirects the user to the provider’s authorization page. After authorization, the provider returns the user to the configured target page and Momen runs the selected On success actionflow.

Errors

  • Unauthenticated (HTTP 403 / ACCOUNT_NOT_AUTHENTICATED): The user is not signed in.
  • Invalid or expired verification code (HTTP 400): The code cannot be verified.
  • Phone or email already bound: The credential is already associated with another account. The action enters On failure.

Examples

Bind a phone number to an existing account

  • Goal: A logged-in user enters their phone number and verification code on their account settings page, then clicks “Bind Phone” to link the phone number to their account.

  • Configuration:

    1. Prerequisites:
      • Create a page named Account Settings.
      • On the Account Settings page, add an Input component named Phone Input, an Input component named Code Input, and a Button component named Bind Button.
    2. Select Component: On the Account Settings page canvas, select the Bind Button.
    3. Add Action: In the right panel, open the Action tab and add an action to On click.
    4. Configure Action:
      • In the action selection dropdown, search for and select Bind account.
      • Set Method to Bind phone.
    5. Bind Parameters:
      • Click the + button next to the Phone parameter, and select Phone Input -> Value.
      • Click the + button next to the Verification code parameter, and select Code Input -> Value.
      • In the On success branch of the action, add a Refresh login user data action to update the local user state.
  • Outcome: When the user enters their phone number and the verification code they received, then clicks the “Bind Phone” button, the phone number is linked to their account. The page data refreshes, and the interface displays the newly bound phone number.


Unbind account

Unlink a phone number, email address, or SSO provider from the signed-in account.

Use cases

  • Replace the phone number or email address associated with an account.

Parameters

ParameterTypeRequiredDescription
MethodEnumYesUnbind method: Unbind phone, Unbind email, or SSO unbind.

Configure the parameters for the selected unbinding method:

Unbind phone / email:

ParameterTypeRequiredDescription
Verification codeTextYesSMS or email verification code used to verify user identity.

SSO unbind:

ParameterTypeRequiredDescription
SSO configurationTextYesThe ID of the SSO configuration item to unbind.

Results

  • Result: None
  • On success: Runs after the credential is unbound.
  • On failure: Runs when the verification code is invalid or the credential is the account’s only sign-in method.

How it works

  • Process:
    • To unbind a phone number or email address, enable the corresponding verification-code sign-in method in project settings.
    • After verifying the code or SSO account, Momen checks whether the account has another sign-in method.
    • Momen refuses to remove the account’s only sign-in method, preventing the user from being locked out.
  • Limitations:
    • Current-user data is not refreshed automatically: Add Refresh login user data to On success, or reload the page, to remove the old phone number or email address from the interface.

Errors

  • Unauthenticated (HTTP 403 / ACCOUNT_NOT_AUTHENTICATED): The user is not signed in.
  • Invalid or expired verification code (HTTP 400): The code cannot be verified.
  • Only sign-in method (HTTP 403 / UNBIND_ONLY_LOGIN_METHOD): The credential is the account’s only sign-in method.
  • SSO configuration not found (HTTP 500 / SSO_ID_NOT_FOUND): The selected SSO configuration does not exist.
  • Account not found (HTTP 404 / EntityNotExistsException): The signed-in account no longer exists.

Examples

Unbind an email address

  • Goal: A logged-in user unlinks their email address from their account by entering a verification code sent to that email and clicking “Unbind Email”.

  • Configuration:

    1. Prerequisites:
      • Create a page named Account Settings.
      • On the Account Settings page, add an Input component named Code Input and a Button component named Unbind Button.
    2. Select Component: On the Account Settings page canvas, select the Unbind Button.
    3. Add Action: In the right panel, open the Action tab and add an action to On click.
    4. Configure Action:
      • In the action selection dropdown, search for and select Unbind account.
      • Set Method to Unbind email.
    5. Bind Parameters:
      • Click the + button next to the Verification code parameter, and select Code Input -> Value.
      • In the On success branch of the action, add a Refresh login user data action to update the local user state.
  • Outcome: When the user enters the verification code received in their email and clicks the “Unbind Email” button, the email is unlinked from their account. The page refreshes, and the email field is cleared.


Reset password

Verify the user’s identity with a code sent to their phone number or email address, then set a new password. This action does not support changing a password by entering the old password.

Use cases

  • Let a user recover a forgotten password with a code sent to a bound phone number or email address.
  • Let a signed-in user verify their identity and set a new password from an account security page.

Parameters

ParameterTypeRequiredDescription
MethodEnumYesReset method: Reset password via phone or Reset password via email.

Configure the parameters for the selected reset method:

Reset password via phone:

ParameterTypeRequiredDescription
Target phone numberTextYesThe phone number bound to this account.
Verification codeTextYesCode sent to the phone number with the Reset password scenario.
New passwordTextYesThe new password set by the user.

Reset password via email:

ParameterTypeRequiredDescription
Target emailTextYesThe email address bound to this account.
Verification codeTextYesCode sent to the email address with the Reset password scenario.
New passwordTextYesThe new password set by the user.

Results

  • Result: None
  • On success: Runs after the password is reset. Add Go to if the user should return to the sign-in page.
  • On failure: Runs when the code or input format is invalid, or when the request fails.

How it works

  • Single-use verification code: Momen checks that the code matches the recipient and invalidates it after successful verification.
  • Password update: Momen encrypts the new password and replaces the previous password.
  • Limitations:
    • Changing the password directly using the old password is not supported.
    • Resetting a password for an account not bound to the relevant phone or email or an inactive account is rejected by the system.

Errors

  • Invalid or expired verification code: The action returns an error and enters On failure.
  • Account or credential not found: The phone number or email address is not bound to an active account.

Examples

Reset a password by phone

  • Goal: A user who forgot their password resets it on the “Forgot Password” page by entering their phone number, the verification code received, and a new password.

  • Configuration:

    1. Prerequisites:
      • Create a page named Forgot Password and a page named Login.
      • On the Forgot Password page, add an Input component named Phone Input, an Input component named Code Input, an Input component named New Password Input, and a Button component named Reset Button.
    2. Select Component: On the Forgot Password page canvas, select the Reset Button.
    3. Add Action: In the right panel, open the Action tab and add an action to On click.
    4. Configure Action:
      • In the action selection dropdown, search for and select Reset password.
      • Set Method to Reset password via phone.
    5. Bind Parameters:
      • Click the + button next to the Target phone number parameter, and select Phone Input -> Value.
      • Click the + button next to the Verification code parameter, and select Code Input -> Value.
      • Click the + button next to the New password parameter, and select New Password Input -> Value.
      • In the On success branch of the action, add a Go to action and set the target page to Login.
  • Outcome: When the user enters their phone number, verification code, and new password, and clicks the “Reset Button”, the password is updated in the database. The user is then redirected to the Login page to sign in with their new password.


Delete account

Let a signed-in user delete their account after confirming their identity with a verification code or password.

Use cases

  • Provide an account-deletion option in user settings to meet product and privacy requirements.

Parameters

ParameterTypeRequiredDescription
Verification code / PasswordTextYesCredential used to confirm the account-deletion request.

Results

  • Result: None
  • On success: After verifying the code or password, Momen soft-deletes the account and signs the user out. It does not show a success message or redirect automatically, so add Show toast and Go to when needed.
  • On failure: If verification or the request fails, Momen keeps the user signed in and displays an error for three seconds.

How it works

  • Soft deletion: Momen removes linked third-party credentials, clears the phone number and email address, replaces the login name and password with random values, and changes the account status to DELETED.
  • Business data remains: Momen updates the account and internal credential records only. It does not automatically delete data in custom tables such as orders or comments. Use triggers or an Actionflow if that data must also be removed or anonymized.

Errors

  • Not signed in: Account not authenticated.
  • Credential not found: PHONE_NUMBER_NOT_FOUND or EMAIL_NOT_FOUND.
  • Account already deleted: account already deleted.
  • Invalid verification code: bad verification code.

Examples

Delete an account with password confirmation

  • Goal: A logged-in user deletes their account on the “Account Settings” page by entering their password and clicking the “Delete Account” button.

  • Configuration:

    1. Prerequisites:
      • Create a page named Account Settings and a page named Home.
      • On the Account Settings page, add an Input component named Password Input and a Button component named Delete Button.
    2. Select Component: On the Account Settings page canvas, select the Delete Button.
    3. Add Action: In the right panel, open the Action tab and add an action to On click.
    4. Configure Action:
      • In the action selection dropdown, search for and select Delete account.
    5. Bind Parameters:
      • Click the + button next to the Verification code / Password parameter, and select Password Input -> Value.
      • In the On success branch of the action, add a Show toast action with the message “Account deleted successfully”, and then add a Go to action to redirect to the Home page.
  • Outcome: When the user enters their password and clicks the “Delete Account” button, the account is soft-deleted in the database, the local session is cleared, a success toast is displayed, and the user is redirected to the Home page as a guest.

Last updated on