HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: /var/www/html/pmw24/wp-content/plugins/advanced-access-manager/media/js/aam-login.js
/**
 * ======================================================================
 * LICENSE: This file is subject to the terms and conditions defined in *
 * file 'license.txt', which is part of this source code package.       *
 * ======================================================================
 */

if (typeof jQuery !== 'undefined') {
    (function ($) {
        $('document').ready(function () {
            $('.login-input').bind('keyup', function(event) {
                if (event.which === 13) {
                    $('.aam-login-submit').trigger('click');
                }
            });

            $('.aam-login-submit').each(function () {
                $(this).bind('click', function () {
                    var button = $(this);
                    var prefix = $(this).data('prefix');
                    
                    var log = $.trim($('#' + prefix + 'log').val());
                    var pwd = $('#' + prefix + 'pwd').val();
                    
                    if (log && pwd) {
                        $('#' + prefix + 'error').css('display', 'none');
                        
                        $.ajax(aamLocal.ajaxurl, {
                            data: {
                                log: log,
                                pwd: pwd,
                                action: 'aamlogin',
                                redirect:  $('#' + prefix + 'redirect').val(),
                                rememberme:  ($('#' + prefix + 'rememberme').prop('checked') ? 1 : 0)
                            },
                            dataType: 'json',
                            type: 'POST',
                            beforeSend: function() {
                                button.attr({
                                    disabled: 'disabled',
                                    'data-original-label': button.val()
                                }).val('Wait...');
                            },
                            success: function(response) {
                                if (response.status === "success") {
                                    if (response.redirect) {
                                        location.href = response.redirect;
                                    }
                                } else {
                                    $('#' + prefix + 'error').html(
                                        response.reason
                                    ).css('display', 'block');
                                }
                            },
                            error: function() {
                                $('#' + prefix + 'error').html(
                                    '<strong>ERROR:</strong> Unexpected error.'
                                ).css('display', 'block');
                            },
                            complete: function() {
                                button.attr({
                                    disabled: null
                                }).val(button.attr('data-original-label'));
                            }
                        });
                        
                    } else {
                        $('#' + prefix + 'error').html(
                            '<strong>ERROR:</strong> Username and password are required.'
                        ).css('display', 'block');
                    }
                });
            });
        });
    })(jQuery);
} else {
    console.log(
            'AAM requires jQuery library in order for login widget to work'
    );
}