added validation for maxLength

This commit is contained in:
Jon Lambson 2017-07-11 16:09:42 -06:00
parent e748d8f849
commit e9a4ff8f9a
2 changed files with 27 additions and 23 deletions

View File

@ -71,7 +71,7 @@
</label> </label>
</div> </div>
<!-- <button class="dap-full-button-green js-remember-btn js-authz-remember-me">SIGN IN ONCE</button> --> <!-- <button class="dap-full-button-green js-remember-btn js-authz-remember-me">SIGN IN ONCE</button> -->
<button type="submit" class="btn btn-primary submit-btn dap-full-button-green js-remember-btn js-authz-remember-me">Submit</button> <button type="submit" class="btn btn-primary submit-btn dap-full-button-green js-remember-btn js-authz-remember-me" disabled>Submit</button>
<!-- <a href="./authnocode.html" target="_blank" class="btn btn-primary">Send Code Again</a> --> <!-- <a href="./authnocode.html" target="_blank" class="btn btn-primary">Send Code Again</a> -->
<button class="btn btn-primary js-edit-email-button" type="button">Edit My Email</button> <button class="btn btn-primary js-edit-email-button" type="button">Edit My Email</button>
</form> </form>

View File

@ -69,28 +69,32 @@ $('body').on('click', '.js-auth-li-enabled', function (ev) {
} }
}); });
// $('body').on('keyup keypress', '.js-authn-otp-code', function (e) { $('body').on('keyup keypress', '.js-authn-otp-code', function (e) {
// 'use strict'; 'use strict';
// var keyCode = e.keyCode || e.which; // var keyCode = e.keyCode || e.which;
// var regex = new RegExp('^[0-9 \-]+$'); // var regex = new RegExp('^[0-9 \-]+$');
// var key = String.fromCharCode(!e.charCode ? e.which : e.charCode); // var key = String.fromCharCode(!e.charCode ? e.which : e.charCode);
// var oauthCode = $(this).val().split('-').join('').replace(/\s/g, ''); // var oauthCode = $(this).val().split('-').join('').replace(/\s/g, '');
// //
// if (!regex.test(key)) { // if (!regex.test(key)) {
// event.preventDefault(); // event.preventDefault();
// return false; // return false;
// } // }
// //
// if (oauthCode.length > 0) { // if (oauthCode.length > 0) {
// oauthCode = oauthCode.match(new RegExp('.{1,4}', 'g')).join("-"); // oauthCode = oauthCode.match(new RegExp('.{1,4}', 'g')).join("-");
// } // }
// //
// $(this).val(oauthCode); // $(this).val(oauthCode);
// //
// if($(this).val().length === $(this).attr("maxlength")){ // if($(this).val().length === $(this).attr("maxlength")){
// $('.submit-btn').prop("disabled", false); // $('.submit-btn').prop("disabled", false);
// } // }
// }); if ($(this).val().length === 14) {
$('.submit-btn').prop('disabled', false);
}
});
$('.js-authn-otp-code').mask('####-####-####'); $('.js-authn-otp-code').mask('####-####-####');