blob: db8d435a893d0491fbd077226e567b7d6b6d5d94 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
<script><!--
document.addEventListener('DOMContentLoaded', function() {
var $login = $('#login');
var $pass1 = $('#pass1');
var $pass2 = $('#pass2');
var $fullname = $('#fullname');
var $msg = $('#add-msg');
var $btn = $('.save-btn');
if (typeof SLX_EDITUSER === 'undefined') {
SLX_EDITUSER = false;
}
var ev = function() {
var msg = '';
if ($login.val().length < 2) {
msg = '{{lang_loginTooShort}}';
} else if ($pass1.val() !== $pass2.val()) {
msg = '{{lang_passwordsDontMatch}}';
} else if ((!SLX_EDITUSER || $pass1.val().length > 0) && $pass1.val().length < 2) {
msg = '{{lang_passwordTooShort}}';
} else if ($fullname.val().length < 1) {
msg = '{{lang_fullnameMissing}}';
}
$msg.text(msg);
$btn.prop('disabled', !!msg);
};
$('.event-box').change(ev).keyup(ev);
if (SLX_EDITUSER) ev();
});
//--></script>
|