Support » Plugin: WP ULike » After updating version 2.8 my ajax login is invalid

  • Resolved CNW

    (@weichangen)


    After updating version 2.8 my ajax login is invalid

    This is my code, do not know and wp-ulike2.8 where the conflict.

    
    // JavaScript Document
    jQuery(document).ready(function($) {
    
        // Perform AJAX login on form submit
        $('form#login').on('submit', function(e){
            $('form#login p.status').show().text(ajax_login_object.loadingmessage);
            //Added data validation
            var username = $('form#login #username').val(),
            	password = $('form#login #password').val(),
            	verifycode = parseInt($('form#login #verifycode').val()),
            	verifyinfo = $('form#login #login_verify_info').val(),
            	verifylnum = parseInt($('.verify_lnum').html()),
            	verifyrnum = parseInt($('.verify_rnum').html()),
            	verifymethod = $('.verify_method').html(),
            	security = $('form#login #security').val(),
            	verify_result = 0;
            
            //For data validation
            if(username == ''){
            	$('form#login p.status').html('Username can not be empty!');
            	return false;
            }else if(password == ''){
            	$('form#login p.status').html('Password is not empty!');
            	return false;       	
            }else if(verifycode == ''){
            	$('form#login p.status').html('Verification code is not empty!');
            	return false;        	
            }
            if(verifymethod == '+'){
            	verify_result = verifylnum + verifyrnum;
            }else{
            	verify_result = verifylnum - verifyrnum;
            }
            if(verify_result != verifycode){
            	$('form#login p.status').html('The code you entered is incorrect');
            	return false;         	
            }
            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: ajax_login_object.ajaxurl,
                data: { 
                    'action': 'ajaxlogin', //calls wp_ajax_nopriv_ajaxlogin
                    'username': username, 
                    'password': password,
                    'verifycode': verifycode,
                    'verifyinfo': verifyinfo,
                    'security': security },
                success: function(data){
                    $('form#login p.status').html(data.message);
                    if (data.loggedin == true){
                        document.location.href = ajax_login_object.redirecturl;
                    }
                }
            });
            e.preventDefault();
        });
    $('form#login p.status').click(function(){$('form#login p.status').hide();});
    });
    
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.