Plugin Directory

Changeset 1271308


Ignore:
Timestamp:
10/22/2015 07:28:13 PM (10 years ago)
Author:
sagor.touch
Message:

Enable ajax login in wp-login.php page.

Location:
els-ajax-login/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • els-ajax-login/trunk/els-ajax-login.php

    r1269709 r1271308  
    150150
    151151
     152#-----------------------------------------------------------------#
     153# Backend login modify
     154#-----------------------------------------------------------------#
     155function appendScriptOnLoginHead()
     156{   
     157    if( is_user_logged_in() )
     158    {
     159        header("location:".admin_url());
     160    }
     161    else{
     162        wp_enqueue_script('jquery');
     163        wp_enqueue_style('els-ajax-login-css', plugin_dir_url(__FILE__).'css/els-ajax-login-css.css', '', '1.0.1');
     164        wp_enqueue_script('els-ajax-login-def', plugin_dir_url(__FILE__).'js/els-ajax-login-def.js', array('jquery'), '1.0.1', TRUE);
     165        wp_localize_script('els-ajax-login-def', 'els_backend_obj', array(
     166            'els_create_nonce' => wp_create_nonce('els-ajax-login-nonce'),
     167            'dashboard' => admin_url(),
     168            'ajaxurl' => admin_url( 'admin-ajax.php' ),
     169            'checking_msg' => __('Checking Authentication, Please wait...'),
     170            'img_URL' => plugin_dir_url(__FILE__).'img/redirecting.gif',
     171        ));
     172    }
     173}
     174add_action('login_footer', 'appendScriptOnLoginHead');
  • els-ajax-login/trunk/js/els-ajax-login-def.js

    r1269709 r1271308  
    9494    });   
    9595   
     96    /**
     97    | Backend login
     98    */
     99    $(window).load(function(){
     100        $('#loginform').prepend('<p class="elsLoginStatus"></p>');
     101    });
     102
     103    $('#wp-submit').click(function(){
     104        var token = els_backend_obj.els_create_nonce;
     105        //alert(token);
     106       
     107        $('.elsLoginStatus').show();
     108        $('.elsLoginStatus').text('');     
     109        $.ajax({
     110            type: 'POST',
     111            dataType: 'json',
     112            url: els_backend_obj.ajaxurl,
     113            data: {
     114                'action': 'elsAjaxLogin', //calls wp_ajax_nopriv_ajaxlogin
     115                'username': $('#loginform #user_login').val(),
     116                'password': $('#loginform #user_pass').val(),
     117                'els_form_token': token
     118            },
     119            success: function(data){
     120                if (data.loggedin == true)
     121                {
     122                    $('body').prepend("<div class='els-popup-overlay'><img class='elsLoadingImg' src='"+els_backend_obj.img_URL+"' alt='Redirecting...' /></div>");
     123                    setTimeout(function(){
     124                        $('.els-popup-overlay').remove();
     125                        setTimeout(statusMsg, 300);
     126                        document.location.href = els_backend_obj.dashboard;
     127                    }, 3000);                 
     128                }
     129                else if (data == 0)
     130                {
     131                    $('.elsLoginStatus').text('You are already logged in!');   
     132                }
     133                else{
     134                    $('body').prepend("<div class='els-popup-overlay'><img class='elsLoadingImg' src='"+els_backend_obj.img_URL+"' alt='Redirecting...' /></div>");
     135                    setTimeout(function(){
     136                        $('.els-popup-overlay').remove();
     137                        setTimeout(statusMsg, 300);
     138                    }, 3000);
     139                }
     140                function statusMsg(){
     141                    $('.elsLoginStatus').text(data.message);   
     142                }               
     143            }
     144        });
     145
     146
     147        return false;     
     148
     149    });
     150   
    96151});
  • els-ajax-login/trunk/readme.txt

    r1269745 r1271308  
    11=== Ajax Login ===
    2 Contributors: sagor.touch
     2Contributors: sagor.touch, sagortouch
    33Tags: ajax-login, sidebar-ajax-login, page-login, admin-login, ajax-admin-login
    44Requires at least: 4.0
    55Tested up to: 4.3.1
    6 Stable tag: 1.0
     6Stable tag: 1.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1818Plugin Features:
    1919
    20 * Click to Loading a progress bar and redirect to admin page.
     20* Click to Loading a progress bar and redirect to admin page.
     21* Enable ajax login in wp-login.php page.
     22* Add ajax login widget.
    2123* Ajax'y applications.
    2224* Added WP Security.
     
    46482. You can use this login form on sidebar widget.
    4749
     503. Enable ajax login in wp-login.php page.
     51
     52= 1.2 =
     53* Enable ajax login in wp-login.php page.
    4854
    4955= 1.0 =
Note: See TracChangeset for help on using the changeset viewer.