1/** 2 * Pages Authentication 3 */ 4 5'use strict'; 6const formAuthentication = document.querySelector('#formAuthentication'); 7 8document.addEventListener('DOMContentLoaded', function (e) { 9 (function () { 10 // Form validation for Add new record 11 if (formAuthentication) { 12 const fv = FormValidation.formValidation(formAuthentication, { 13 fields: { 14 username: { 15 validators: { 16 notEmpty: { 17 message: 'Please enter username' 18 }, 19 stringLength: { 20 min: 6, 21 message: 'Username must be more than 6 characters' 22 } 23 } 24 }, 25 email: { 26 validators: { 27 notEmpty: { 28 message: 'Please enter your email' 29 }, 30 emailAddress: { 31 message: 'Please enter valid email address' 32 } 33 } 34 }, 35 'email-username': { 36 validators: { 37 notEmpty: { 38 message: 'Please enter email / username' 39 }, 40 stringLength: { 41 min: 6, 42 message: 'Username must be more than 6 characters' 43 } 44 } 45 }, 46 password: { 47 validators: { 48 notEmpty: { 49 message: 'Please enter your password' 50 }, 51 stringLength: { 52 min: 6, 53 message: 'Password must be more than 6 characters' 54 } 55 } 56 }, 57 'confirm-password': { 58 validators: { 59 notEmpty: { 60 message: 'Please confirm password' 61 }, 62 identical: { 63 compare: function () { 64 return formAuthentication.querySelector('[name="password"]').value; 65 }, 66 message: 'The password and its confirm are not the same' 67 }, 68 stringLength: { 69 min: 6, 70 message: 'Password must be more than 6 characters' 71 } 72 } 73 }, 74 terms: { 75 validators: { 76 notEmpty: { 77 message: 'Please agree terms & conditions' 78 } 79 } 80 } 81 }, 82 plugins: { 83 trigger: new FormValidation.plugins.Trigger(), 84 bootstrap5: new FormValidation.plugins.Bootstrap5({ 85 eleValidClass: '', 86 rowSelector: '.mb-3' 87 }), 88 submitButton: new FormValidation.plugins.SubmitButton(), 89 90 defaultSubmit: new FormValidation.plugins.DefaultSubmit(), 91 autoFocus: new FormValidation.plugins.AutoFocus() 92 }, 93 init: instance => { 94 instance.on('plugins.message.placed', function (e) { 95 if (e.element.parentElement.classList.contains('input-group')) { 96 e.element.parentElement.insertAdjacentElement('afterend', e.messageElement); 97 } 98 }); 99 } 100 }); 101 } 102 103 // Two Steps Verification 104 const numeralMask = document.querySelectorAll('.numeral-mask'); 105 106 // Verification masking 107 if (numeralMask.length) { 108 numeralMask.forEach(e => { 109 new Cleave(e, { 110 numeral: true 111 }); 112 }); 113 } 114 })(); 115});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.