Created
July 13, 2009 09:24
Revisions
-
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,141 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB"> <head profile="http://dublincore.org/documents/dcq-html/"> <title>Change Password</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <form action="" id="changepw" name="changepw" method="post"> <div> <table> <tr> <td width="26%" valign="top">New Password:</td> <td> <label for="password"> <input class="textfield" type="password" id="password" name="password" maxlength="32" tabindex="1"/> </label> </td> </tr> <tr> <td valign="top">Repeat Password:</td> <td> <label for="repeatpassword"> <input class="textfield" type="password" id="repeatpassword" name="repeatpassword" maxlength="32" tabindex="2"/> </label> <input type="submit" class="submit changepassword" name="change" value="Change Password" tabindex="3"/> </td> </tr> </table> </div> </form> <script type="text/javascript">document.forms.changepw.password.focus();</script> <script type="text/javascript" src="glow/1.5.1/core/core.js"></script> <script type="text/javascript"> var myGlowForm = new glow.forms.Form("#changepw"); myGlowForm.addTests( "password", ["required", { on: "idle change submit", message:"We're very security conscious, enter a password" } ], ["minLen", { on: "idle change submit", arg: 8, message:"Passwords must have a minimum of 8 characters" } ], ["maxLen", { on: "idle change submit", arg: 33, message:"Passwords cannot have more than 32 characters" } ], ["regex", { on: "idle change submit", arg: /^[A-Za-z0-9_]+$/, message:"Passwords can only contain letters, numbers and the underscore character" } ], ["regex", { on: "idle change submit", arg: /([A-Z].*[0-9]|[0-9].*[A-Z])/, message:"Passwords must contain at least one uppercase character and number" } ], ["custom", { on: "idle change submit", arg: function( values, opts, callback, formData ) { var message = "Character entered more than twice"; var aChars = {}; for( var i = 0; i < values[0].length; ++i ) { var char = values[0].charAt(i); if( typeof( aChars[char] ) == 'undefined' ) { aChars[char] = 1; continue; } ++aChars[char]; if( aChars[char] > 2 ) { return callback( glow.forms.FAIL, message ); } } return callback( glow.forms.PASS, message ); } } ], ["ajax", { on: "idle change submit", arg: function( response ) { answer = response.json(); if( !!answer.success ) { return glow.forms.PASS; } callback(glow.forms.FAIL, 'You enter a previous Password'); return; }, url: "ajax.php.html?password={password}"//, // message: "You enter a previous Password" } ] ).addTests( "repeatpassword", ["sameAs", { on: "idle change submit", arg: "password", message:"Passwords don't match!" } ] ); </script> <style> .glow-errorMsg { display: block; margin-top: 5px; font-weight: bold; color: red; } .glow-errorSummary { display: none; } </style> </body> </html>