How to change step icon color? (Wappler extension)

How to change step icon color?

image

HJSON:

[
  {
    type: "turnstile",
    module: "turnstile",
    action: "validate",
    groupTitle: "Security",
    groupIcon: "fas fa-lg fa-sync",
    title: "Validate Turnstile captcha",
    icon: "fas fa-lg fa-sync",
    properties: [
      {
        group: "Captcha settings",
        variables: [
          {
            name: "actionName",
            optionName: "name",
            title: "Name",
            type: "text",
            required: true,
            defaultValue: ""
          },
          {
            name: "secret",
            optionName: "secret",
            title: "Secret Key",
            type: "text",
            required: true,
            defaultValue: "",
            serverDataBindings: true,
            help: "The Cloudflare Turnstile secret key"
          },
          {
            name: "msg",
            optionName: "msg",
            title: "Error Message",
            type: "text",
            required: false,
            defaultValue: "Captcha check failed",
            serverDataBindings: true,
            help: "Custom error message for failed captcha validation"
          }
        ]
      }
    ]
  }
]

JSON if needed:

const querystring = require('querystring');
const https = require('https');

exports.validate = function(options) {
    const secret = this.parseRequired(options.secret, 'string', 'recaptcha.validate: secret is required.');
    const msg = this.parseOptional(options.msg, 'string', 'Recaptcha check failed.');

    const response = this.req.body['g-recaptcha-response'];
    const remoteip = this.req.ip;
    const data = querystring.stringify({ secret, response, remoteip });

    return new Promise((resolve, reject) => {
        const req = https.request('https://challenges.cloudflare.com/turnstile/v0/siteverify', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded',
                'Content-Length': data.length
            }
        }, (res) => {
            let body = '';

            res.setEncoding('utf8');
            res.on('data', (chunk) => body += chunk);
            res.on('end', () => {
                if (res.statusCode >= 400) return reject(body);
                
                if (body.charCodeAt(0) === 0xFEFF) {
                    body = body.slice(1);
                }

                body = JSON.parse(body);

                if (!body.success) {
                    this.res.status(400).json({
                        form: { 'g-recaptcha-response': msg }
                    });
                }

                resolve(body);
            });
        });

        req.on('error', reject);
        req.write(data);
        req.end();
    });
};

You mean this?

2 Likes

Thank you! That's exactly it.

1 Like