1const spinner = '<div uk-spinner></div>'; 2 3$(() => { 4 5 // Click #akt-show-login 6 $('#akt-show-login').click((e) => { 7 e.preventDefault(); 8 $('.tx-akt-login-code').slideDown(400); 9 $('html, body').animate({ 10 scrollTop: $(".tx-akt-login-code").offset().top-170 11 }, 400); 12 $('#tx-aktlogincode-email').focus(); 13 }); 14 15 // Parsley form validation 16 $('#tx-aktlogincode-form').parsley().on('field:validated', function () { 17 var ok = $('.parsley-error').length === 0; 18 $('.bs-callout-info').toggleClass('hidden', !ok); 19 $('.bs-callout-warning').toggleClass('hidden', ok); 20 }) 21 .on('form:submit', function () { 22 // do nothing 23 }); 24 25 26 // Get formdata on submit and send the data to the server 27 $('#tx-aktlogincode-form').submit(function (e) { 28 e.preventDefault(); 29 30 // Get formdata 31 let formdata = $('#tx-aktlogincode-form').serializeArray(); 32 33 getCode(formdata); 34 35 }.bind(this)); 36 37 // Get formdata on click request code button 38 $(document).on("click", "#tx-aktlogincode-login-btn", function (e) { 39 e.preventDefault(); 40 41 // Get formdata 42 let formdata = $('#tx-aktlogincode-form').serializeArray(); 43 sendLoginRequest(formdata) 44 45 }); 46 47}); 48 49function sendLoginRequest(formdata) { 50 // Save button text 51 const btnHtml = $('#tx-aktlogincode-login-btn').html(); 52 // Show spinner instead of button text 53 $('#tx-aktlogincode-login-btn').html(spinner); 54 55 $.ajax({ 56 type: "POST", 57 url: "/akt-request/login", 58 data: formdata, 59 success: function (data) { 60 console.log('response', data); 61 62 // If the user was logged in: redirect him to the after login page 63 if (data.success) { 64 window.location.href = redirectAfterLoginUrl; 65 } else { 66 // Show error message 67 $('#tx-aktlogincode-error').show(); 68 // Remove spinner and set original button text 69 $('#tx-aktlogincode-login-btn').html(btnHtml); 70 } 71 72 }, 73 error: function (data) { 74 console.log('error', data); 75 } 76 }); 77} 78 79 80function getCode(formdata) { 81 // Save button text 82 var btnHtml = $('#tx-aktlogincode-request-btn').html(); 83 // Show spinner instead of button text 84 $('#tx-aktlogincode-request-btn').html(spinner); 85 86 $.ajax({ 87 type: "POST", 88 url: "/akt-request/get-code", 89 data: formdata, 90 success: function (data) { 91 console.log('response', data); 92 93 // User does not exist: redirect to registration page 94 if (data.redirectToRegister) { 95 window.location.href = registrationRedirectUrl; 96 } 97 98 // Code was sent to user: show the code field and login button 99 if (data.loginCodeSent) { 100 $('#tx-aktlogincode-register').fadeOut(400); 101 setTimeout(()=>{ 102 $('#tx-aktlogincode-field').slideDown(400); 103 $('#tx-aktlogincode-code').focus(); 104 },400); 105 // Disable request button 106 $('#tx-aktlogincode-request-btn').attr('disabled', true); 107 // Enable textfield and submit button for login code 108 $('#tx-aktlogincode-code, #tx-aktlogincode-login-btn').attr('disabled', false); 109 // Show info message 110 $('#tx-aktlogincode-success').show(); 111 // Remove spinner and set original button text 112 $('#tx-aktlogincode-request-btn').html(btnHtml); 113 } 114 }, 115 error: function (data) { 116 console.log('error', data); 117 } 118 }); 119}
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.