1jQuery(document).ready(function ($) { 2 // Display form from link inside a popup 3 $('.pop_login').on('click', function (e) { 4 $('#myModalRegister').modal('hide'); 5 $('#myModalLogin').modal('show'); 6 return false; 7 }); 8 9 // Perform AJAX login/register on form submit 10 $('form#login, form#register').on('submit', function (e) { 11 if (!$(this).valid()) return false; 12 $('p.status', this).show().text(ajax_auth_object.loadingmessage); 13 action = 'ajaxlogin'; 14 username = $('form#login #username').val(); 15 password = $('form#login #password').val(); 16 email = ''; 17 security = $('form#login #security').val(); 18 if ($(this).attr('id') == 'register') { 19 var action = 'ajaxregister'; 20 var username = $('#signonname').val(); 21 var password = $('#signonpassword').val(); 22 var email = $('#email').val(); 23 var security = $('#signonsecurity').val(); 24 var firstname = $('#firstname').val(); 25 var lastname = $('#lastname').val(); 26 var profile_type = $('#profile_type').val(); 27 var specified_profile = $('#specified_profile').val(); 28 var company_size = $('#company_size select').val(); 29 var company_sales = $('#company_sales select').val(); 30 var company_type = $('#company_type select').val(); 31 32 var dataarray = { 33 'action': action, 34 'username': username, 35 'password': password, 36 'email': email, 37 'security': security, 38 'firstname': firstname, 39 'lastname': lastname, 40 'action_profile_type': profile_type, 41 'action_specified_profile': specified_profile, 42 'action_company_size_all': company_size, 43 'action_company_sales': company_sales, 44 'action_company_type': company_type 45 }; 46 47 }else{ 48 var dataarray = { 49 'action': action, 50 'username': username, 51 'password': password, 52 'email': email, 53 'security': security 54 }; 55 } 56 ctrl = $(this); 57 $.ajax({ 58 type: 'POST', 59 dataType: 'json', 60 url: ajax_auth_object.ajaxurl, 61 data: dataarray, 62 success: function (data) { 63 $('p.status', ctrl).text(data.message); 64 // if (data.loggedin == true) { 65 // document.location.href = ajax_auth_object.loginsurl; 66 // } 67 if (data.loggedin == true && data.action == 'registration') { 68 var parameters = 'action=newuser&uname='+username+'&email='+email; 69 document.location.href = ajax_auth_object.loginsurl+'?'+parameters; 70 }else if (data.loggedin == true) { 71 //document.location.href = ajax_auth_object.loginsurl; 72 window.location.reload(); 73 } 74 } 75 }); 76 e.preventDefault(); 77 }); 78 79 80 /*=============================== Password Settings ================================*/ 81 // Perform AJAX passwdsettings on form submit 82 83 jQuery('#passwdsettings').on('submit', function (e) { 84 if (!jQuery(this).valid()) return false; 85 jQuery('p.status', this).show().text(ajax_auth_object.loadingmessage); 86 action = 'ajaxpasswdsettings'; 87 username = jQuery('.passwdsetting #signonname').val(); 88 password = jQuery('.passwdsetting #signonpassword').val(); 89 email = jQuery('.passwdsetting #email').val(); 90 security = jQuery('.passwdsetting #accountsecurity').val(); 91 firstname = jQuery('.passwdsetting #firstname').val(); 92 lastname = jQuery('.passwdsetting #lastname').val(); 93 94 var dataarray = { 95 'action': action, 96 'username': username, 97 'password': password, 98 'email': email, 99 'security': security, 100 'firstname': firstname, 101 'lastname': lastname, 102 }; 103 104 ctrl = jQuery(this); 105 $.ajax({ 106 type: 'POST', 107 dataType: 'json', 108 url: ajax_auth_object.ajaxurl, 109 data: dataarray, 110 cache: false, 111 success: function (data) { 112 jQuery('p.status', ctrl).text(data.message); 113 if (data.redirecturl == true) { 114 var currenturl = window.location.href.split('?');; 115 document.location.href = currenturl[0]+'?action=update'; 116 } 117 } 118 }); 119 e.preventDefault(); 120 }); 121 122 123 // Client side form validation 124 if (jQuery("#register").length) 125 jQuery("#register").validate({ 126 rules:{ 127 repeat_password:{ equalTo:'#signonpassword' }, 128 reptemail:{ equalTo:'#email' } 129 } 130 }); 131 else if (jQuery("#login").length) 132 jQuery("#login").validate(); 133});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.