CMD_JSON_VALIDATE to verify types before submission

Version 1.514

Feature
Finished

Command for ajax calls, to make validation checks before submission. This will save an invalid form post, causing the User to have to re-enter all their info again. type=user&value=fred type=domain&value=domain.com type=password&value=secretpass type=password&action=get #returns a new random password that passed the difficult password check type=dbname&value=dbname (exclude the username_ prefix) type=dbusername&value=dbuser (exclude the username_ prefix) type=email&value=user@domain.com (full address) type=ftp&value=user&domain=domain.com (only user part) - added 1.53.1 type=forwarder&value=user@domain.com (full address) type=username&value=fred (can only be called by Resellers and Admins, or error "Users cannot verify usernames") type=dns&record=A&domain=domain.com&name=www&value=1.2.3.4(&mx_value=mail.domain.com.(&select=name|value)) - added 1.53.2. Returns json with either: { "error": "some reason" } or: { "success": "" } or for random password generation (action=yes) { "success": "newrandompassword" } Note that the User and domain checks do use the Multi-Server Setup system, if it's enabled where it will check for external domains or username, if those options are checked. Similar to the functions: CMD_AJAX_CHECK_USERNAME CMD_AJAX_CHECK_DOMAIN CMD_AJAX_CHECK_PASSWORD ============= type=dns - added 1.53.2 This method allows validation of dns form values. There are quite a lot of internal checks and variations depending on record type, so please read carefully. record=A|NS|MX|CNAME|PTR|TXT|AAAA|SRV|SPF|TLSA|CAA|DS name=left side of add value=right side of add if record=MX, then things change depending on settings. if full_mx_records=1 in directadmin.conf, then: value=10 - the priority of the MX mx_value=mail or mail.domain.com. if full_mx_records=0, which will be rare and not default, then: name=mail or mail.domain.com (right side) value=10 - priority if record=NS: value=left side name=right side just to be backwards compatible with the older DA where the container could only have a unique index, thus all NS records for the zone would match, hence we flipped to use the value as the index. But duplicates can now be used, but the value/name are still flipped left to right. --- optional for type=dns: check=name|value where adding check to "name" or "value" will tell DA only to check the respective name or value. Lets provides more specific control over the checks.

Interested to try DirectAdmin? Get a 30-day Free Trial!