Customize error for wrong mobile number and otp in lock passwordless universal Login

Hi @ssharma,

Welcome to the Community!

You can customize the passwordless error messages like this:

    var languageDictionary = {
        error: {
          passwordless: {
           // User enters incorrect code
            invalid_user_password: 'That is not the code',
           // User does not enter code (i.e. leaves field blank)
            'bad.verification_code': 'No code provided',
            // invalid phone number
            'bad.phone_number': 'Please enter a valid phone number'
          }
        }
    };

You can update your lock code like so:

const config = JSON.parse(decodeURIComponent(escape(window.atob('@@config@@'))));
       config.extraParams = config.extraParams || {};
       const connection = config.connection;
       const prompt = config.prompt;
       var languageDictionary;
       var language;

       if (config.dict && config.dict.signin && config.dict.signin.title) {
           languageDictionary = { title: '' };
       } else if (typeof config.dict === 'string') {
           language = config.dict;
       }
       languageDictionary = Object.assign(languageDictionary, {
           "error": {
              passwordless: {
               // User enters incorrect code
                invalid_user_password: 'That is not the code',
               // User does not enter code (i.e. leaves field blank)
                'bad.verification_code': 'No code provided',
                // invalid phone number
                'bad.phone_number': 'Please enter a valid phone number!!!'
              }
           }
       })
       const loginHint = config.extraParams.login_hint;

       const lock = new Auth0LockPasswordless(config.clientID, config.auth0Domain, {
           auth: {
               redirectUrl: config.callbackURL,
               responseType: (config.internalOptions || {}).response_type ||
                   (config.callbackOnLocationHash ? 'token' : 'code'),
               params: config.internalOptions
           },
           configurationBaseUrl: config.clientConfigurationBaseUrl,
           overrides: {
               __tenant: config.auth0Tenant,
               __token_issuer: config.authorizationServer.issuer
           },
           assetsUrl: config.assetsUrl,
           allowedConnections: connection ? [connection] : null,
           rememberLastLogin: !prompt,
           language: language,
           languageDictionary: languageDictionary,
           theme: {
               logo: '"',
               primaryColor: '#8d1831'
           },
           closable: false
       });

       lock.show();
1 Like