Changeset 2050


Ignore:
Timestamp:
06/14/17 19:45:20 (7 years ago)
Author:
nanardon
Message:

Avoid useless ajax request when changing password

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts-Web/root/html/users/passwd.tt

    r1366 r2050  
    44<script type="text/javascript"> 
    55function check_passwd() { 
    6     $.ajax({ 
    7         url: '[% c.uri_for('/ajax', 'cracklib', username) %]', 
    8         data: { passwd: $("#passwd").val(), cpasswd: $("#cpasswd").val() }, 
    9     }).done(function(msg) { 
    10         $('#perror').html(msg); 
    11     }); 
     6    if ($("#passwd").val()) { 
     7        if ($("#passwd").val() == $("#cpasswd").val()) { 
     8            $.ajax({ 
     9                url: '[% c.uri_for('/ajax', 'cracklib', username) %]', 
     10                data: { passwd: $("#passwd").val(), cpasswd: $("#cpasswd").val() }, 
     11            }).done(function(msg) { 
     12                $('#perror').html(msg); 
     13            }); 
     14        } else { 
     15            $('#perror').html('[% l('Password are different') %]'); 
     16        } 
     17    } else { 
     18        $('#perror').html('[% l('Please enter password') %]'); 
     19    } 
    1220} 
    1321</script> 
Note: See TracChangeset for help on using the changeset viewer.