ajax for password check and username check (SKINS)

Version 1.45

Feature
Finished

When creating a DA User, a valid username, domain and password is required. Currently, javascript is used for this, but if the "difficult password" option is enabled, and the options are changed, then without this feature, the javascript also needs to be changed. The feature will use ajax to ask DA if the password is valid, rather than relying on just javascript. The same idea can be used for a username check.. although the validity never really changes, the existence of a value that already exists can. The domain value will be checked as well. Note that these checks are more than just validity checks; they will also check for the existence of values on other boxes if the multi-server setup is used, or values already exist on the box. As such, they could be tools used to determine if a value exists on the server, but it's nothing different than actually submitting the form.. would give the same error anyway. The "Random" buttons, for new passwords, will also fetch a new value from ajax. This is handy, because DA will internally try the new password against the diffiult password script (if enabled) up to 20 times, to try and satisfy whatever creative rules you may have added. If it fails after 20 tries, you can still type in a value to try and satisfy it by hand. Also, the output from the difficult password script is dumped directly into the error div, so if you have a custom rule, you can tell the User exactly what they're typing wrong, causing less confusion. Requires: ajax=1 to be set in the directadmin.conf. The internal default is: ajax=0 may be turned on by default for a future version. Related: http://www.directadmin.com/features.php?id=1312 note: enabling ajax for these form checks also enables the username auto-fill in the "change password" page for Admin/Resellers. CMD_AJAX_CHECK_USERNAME?username=fred CMD_AJAX_CHECK_PASSWORD?passwd=pass CMD_AJAX_CHECK_PASSWORD?action=get CMD_AJAX_CHECK_DOMAIN?domain=domain.com SKINS: new file: creation_check.js files_user.conf: JS_CREATION_CHECK=creation_check.js Account creation (Admin/Reseller/User), but not in the "customize" areas. admin/create_admin.html admin/create_reseller.html reseller/create_user.html user/add_domain.html The username, domain, passwd, and passwd2 files need id values with the same name, eg: id=username name=username, etc.. Also, to the right of the file, for username, domain, and passwd, a div is added, eg: <div id=username_result class=warning></div> and for id=domain_result, id=passwd_result. As well, anywhere there is a "Random" button, similar to above, the password bits are there as well. user/db/db_create.html user/db/db_user_create.html user/db/db_user_modify.html user/ftp/ftp_create.html user/ftp/ftp_show.html admin/change_user_password.html --------------------- Example changes for create_reseller.html (has username, domain, passwd, passwd2) |?CHECK_NAME=checkName()| |?CHECK_PASS=| |?RANDOM_PASS=randomPass()| |?CHECK_DOMAIN=checkDomain()| |*if AJAX="1"| |?CHECK_NAME=ajax_checkName()| |?CHECK_PASS=onChange="ajax_checkPass()"| |?RANDOM_PASS=ajax_randomPass('')| |?CHECK_DOMAIN=ajax_checkDomain()| <script type="text/javascript" src="JS_CREATION_CHECK"></script> |*endif| <input type=text id=username name=username size=32 maxlength=|MAX_USERNAME_LENGTH| onChange="|CHECK_NAME|"><div id=username_result class=warning></div> <input type=password id=passwd name=passwd size=32 |CHECK_PASS|> <input type=button value="|LANG_RANDOM|" onClick="|RANDOM_PASS|"><div id=passwd_result class=warning></div> <input type=password id=passwd2 name=passwd2 size=32 onChange="checkPass()"> <input type=text id=domain name=domain size=32 onChange="|CHECK_DOMAIN|"><div id=domain_result class=warning>

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