1$(function () { 2 $(document).on('click', '#btnLogin', Login); 3 $(document).on('click', '#lnkForgottenPassword', showForgottenDetails); 4 $(document).on('click', '#btnRequestPassword', RequestForgottenDetails); 5 6 7 8 var vCookie = GetCookie('bufdgLoginCookie'); 9 if (vCookie.indexOf('|') > 0 && vCookie.split('|')[0].length > 0 && vCookie.split('|')[1].length > 0) { 10 $('#username').val(vCookie.split('|')[0]); 11 $('#password').val(vCookie.split('|')[1]); 12 $('#remembermydetails').attr('checked', true); 13 $('#password').prev('label').hide(); 14 } 15}); 16 17/** 18 * 19 * @param {any} 20 */ 21function Login() 22{ 23 var vRememberDetails = false; 24 25 if ($('#remembermydetails').is(":checked")) 26 { 27 vRememberDetails = true; 28 } 29 30 var vPageLink = getQuerystring('p', ''); 31 if (window.location.href.indexOf('?p=') != -1) { 32 vPageLink = window.location.href.substring(window.location.href.indexOf('?p=') + 3); 33 } 34 35 if (vEventID !== -1) { 36 vPageLink = "eventbooking/view?id=" + vEventID + "&r=1"; 37 } 38 39 Proxy.postAjax( 40 "Login", 41 "Authenticate", 42 JSON.stringify({ 43 Username: $('#username').val(), 44 Password: $('#password').val() 45 }), 46 function (result) { 47 // Hide any previous errors displayed on the page. 48 $('#toplogin .error').hide(); 49 $('#login .error').hide(); 50 51 if (result.AuthenticateResult.Success) 52 { 53 localStorage.token = result.AuthenticateResult.Token; 54 55 fetch 56 ( 57 '/SCONULLogin/PostLoginDetails', 58 { 59 method: 'POST', 60 headers: 61 { 62 'Accept': 'application/json', 63 'Content-Type': 'application/json', 64 }, 65 body: JSON.stringify({ Username: $('#username').val(), Password: $('#password').val(), RememberMe: vRememberDetails }) 66 } 67 ) 68 .then((response) => response.json()) 69 .then((data) => { 70 // Get the page link from the query string. 71 if (vPageLink.indexOf("PHESDownload") != -1) { 72 //were trying to view a document so open in new link and move to home page 73 OpenWindow(unescape(vPageLink)); 74 vPageLink = vMyDetails; 75 } 76 77 // Check to see if a page has been selected to move the user to. 78 if (vPageLink.length <= 0) { 79 // Default the user back to the My Bufdg page. 80 vPageLink = vMyDetails; 81 } 82 83 if (vRememberDetails) { 84 SetCookie('bufdgLoginCookie', $('#username').val() + '|' + data.message, 365); 85 } 86 else { 87 SetCookie('bufdgLoginCookie', '', -1); 88 } 89 90 if (data.extraDetails.length) { 91 var notification = JSON.parse(data.extraDetails); 92 93 $(".notificationContent").html(notification.HTML); 94 95 if (notification.AllowDefer) { 96 $('#btnDefer').attr('data-page-link', vPageLink); 97 $('#btnDefer').show(); 98 } 99 else { 100 $('#btnDefer').hide(); 101 } 102 103 $('#notificationPopup-Title').html(notification.Title); 104 $('#btnNotificationAction').html(notification.ButtonText); 105 $('#btnNotificationAction').attr('data-action-id', notification.NotificationID); 106 $('#btnNotificationAction').attr('data-action-url', notification.ButtonLink); 107 108 $("#notificationPopup").modal('show'); 109 } 110 else { 111 if (vPageLink == '/') { 112 vPageLink = vHomePage; 113 } 114 115 vPageLink 116 117 // Move the user to the original page they were looking at. 118 window.location = decodeURI(vPageLink); 119 } 120 }); 121 } 122 else { 123 switch (result.AuthenticateResult.Message) { 124 case ('2'): 125 { 126 $('#IncorrectUserName').show(); 127 } 128 break; 129 130 case ('3'): 131 { 132 $('#IncorrectDetails').show(); 133 } 134 break; 135 136 case ('4'): 137 { 138 $('#InactiveUser').show(); 139 } 140 break; 141 142 case ('5'): 143 { 144 $('#DBMember').show(); 145 } 146 break; 147 } 148 } 149 } 150 ); 151} 152 153/** 154* 155* @param {any} 156*/ 157function showForgottenDetails() { 158 $("#forgottenDetailsPopup").modal("show"); 159} 160 161/** 162* 163* @param {any} 164*/ 165function RequestForgottenDetails() { 166 Proxy.postAjax 167 ( 168 "Members", 169 "SendForgottenPasswordRequest", 170 JSON.stringify 171 ( 172 { 173 strEmail: $("#txtforgottenDetailsEmail").val() 174 } 175 ), 176 function (result) { 177 if (result.SendForgottenPasswordRequestResult) { 178 ShowMessage( 179 'Email Sent', 180 'A email has been sent to ' + $("#txtforgottenDetailsEmail").val() + ' please click the link in the email to reset your password' 181 ); 182 183 $("#forgottenDetailsPopup").modal("hide"); 184 } 185 else { 186 ShowMessage( 187 'Error', 188 'Failed to send forgotten details reminder, please ensure the email address was typed correctly' 189 ); 190 } 191 }); 192}
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.