@auth0/auth0-acul-js - v1.0.0
    Preparing search index...

    Class SignupPassword

    Hierarchy

    • BaseContext
      • SignupPassword

    Implements

    Index

    Constructors

    Properties

    screenIdentifier: string = ScreenIds.SIGNUP_PASSWORD

    Methods - Language

    • Utility Feature

      Changes the language/locale for the current authentication flow.

      This method triggers a language change by submitting the new locale preference to the server with the 'change-language' action. The language change will cause the current screen to re-render with the new locale.

      Parameters

      • options: Screens.LanguageChangeOptions

        Language change options including the target language code

        Options for changing the language/locale during the authentication flow

        • [key: string]: string | number | boolean | undefined

          Additional custom fields to be submitted along with the language change. Custom fields should be prefixed with 'ulp-'.

        • language: string

          Short language name (locale code) to be set (e.g., 'en', 'fr', 'es').

        • Optionalpersist?: "session"

          Defines persistence scope for the language preference. Currently only 'session' is supported.

          'session'
          

      Returns Promise<void>

      A promise that resolves when the form submission is complete

      import LoginId from "@auth0/auth0-acul-js/login-id";

      const loginManager = new LoginId();

      // Change language to French
      await loginManager.changeLanguage({
      language: 'fr',
      persist: 'session'
      });
      import LoginPassword from "@auth0/auth0-acul-js/login-password";

      const loginPasswordManager = new LoginPassword();

      // Change language to Spanish with additional custom data
      await loginPasswordManager.changeLanguage({
      language: 'es',
      persist: 'session',
      'ulp-custom-field': 'custom-value'
      });
      • This method is available on all screen instances that extend BaseContext
      • The language must be one of the enabled locales configured in your Auth0 tenant
      • The screen will automatically re-render with the new language after submission
      • Custom fields can be included and will be accessible in the Post Login Trigger

    Methods - Other

    • Parameters

      Returns Promise<void>

      This methods handles signup-password related screen configuration. It allows to proceed with registering signup password along with signup identifiers passed in previous screen

      import SignupPassword from "@auth0/auth0-acul-js/signup-password";

      const signupPasswordManager = new SignupPassword();
      const { transaction, screen } = signupPasswordManager;

      //get mandatory & optional identifiers required for signup-password screen to proceed
      const mandatoryIdentifier = transaction.getRequiredIdentifiers(); //eg: email
      const optionalIdentifiers = transaction.getOptionalIdentifiers() //eg: phone

      //get signup data submitted on previous screen from previous screen
      const data = transaction.screen.getScreenData(); //eg: email, phone


      const signupParams = {
      email : data.email,
      password: "******"
      };

      signupPasswordManager.signup(signupParams);
    • Returns Promise<void>

      This method handles switching between different database connections. It allows users to switch to a different connection during the signup process.

      import SignupPassword from "@auth0/auth0-acul-js/signup-password";

      const signupPasswordManager = new SignupPassword();

      // Function to handle connection switching
      const handleSwitchConnection = (connectionName: string) => {
      signupPasswordManager.switchConnection({ connection: connectionName });
      };

      // Switch to different connection strategies
      handleSwitchConnection('email'); // Switch to email-based authentication
      handleSwitchConnection('sms'); // Switch to SMS-based authentication
    • Utility Feature

      Validates a password string against the current transaction's password policy.

      This method retrieves the password policy from the current transaction context and delegates the actual validation to coreValidatePassword.

      It returns an array of validation results, each containing:

      • code: the identifier of the password rule,
      • policy: a user-friendly description of the rule,
      • isValid: boolean indicating if the password passed that rule.

      Parameters

      • password: string

        The password string to validate.

      Returns Screens.PasswordValidationResult

      import SignupPassword from "@auth0/auth0-acul-js/signup-password";
      const signupPasswordManager = new SignupPassword();
      const validationResults = signupPasswordManager.validatePassword('MyP@ssw0rd!');
      console.log(validationResults);
      // [
      // { code: 'password-policy-length-at-least', policy: 'At least 12 characters', isValid: false },
      // { code: 'password-policy-lower-case', policy: 'Lowercase letters (a-z)', isValid: true },
      // ...
      // ]