1angular.module('BungeeApp') 2 .controller('PublicLoginRegisterController', function ($scope, $compile, $window, $uibModal, AppConstants, $timeout, screen, brand, logoId, siteName, customerId, slug, sitedata) { 3 $scope.customerId = customerId; 4 $scope.siteName = siteName; 5 $scope.logoId = logoId; 6 $scope.slug = slug; 7 $scope.sitedata = sitedata; 8 9 $scope.questions = []; 10 11 $scope.ajaxCall('/Customer/GetCustomerForm', { customerId: $scope.customerId, includeAdminOnlyFields: false }, function (data) { 12 $scope.questions = data; 13 }, function (data) { 14 console.log("Failed to get customer form"); 15 }, false); 16 17 $scope.section = ""; 18 if (screen == "login") { 19 $scope.section = "login"; 20 } else { 21 $scope.section = "create1"; 22 } 23 24 $scope.termsOfService = null; 25 if (brand == "membershine") { 26 $scope.termsOfService = "https://membershine.com/terms-of-service/"; 27 } else { 28 $scope.termsOfService = "https://hoastart.com/terms-of-service/"; 29 } 30 31 $scope.setSection = function (section) { 32 $scope.section = section; 33 } 34 35 $scope.states = []; 36 $scope.ajaxCall('/State/StateList', {}, function (data) { 37 $scope.states = data; 38 }); 39 40 $scope.countries = null; 41 $scope.ajaxCall('/Country/CountryList', {}, function (data) { 42 $scope.countries = data; 43 }); 44 45 $scope.loginDetails = { username: '', password: '', persist: false }; 46 $scope.loginValidationRan = false; 47 $scope.doLogin = function (form) { 48 $scope.loginValidationRan = true; 49 if (form.$invalid) { 50 return false; 51 } 52 53 if (brand == "membershine") { 54 $scope.loginDetails.persist = false; 55 $scope.ajaxCall('/LoginService/CheckMembershineLogin', $scope.loginDetails, function (data) { 56 $scope.$close(true); 57 }); 58 } else { 59 $scope.loginDetails.persist = false; 60 $scope.ajaxCall('/LoginService/CheckHoastartLogin', $scope.loginDetails, function (data) { 61 $scope.$close(true); 62 }); 63 } 64 }; 65 66 $scope.newAccount = { state: null, country: 1 }; 67 $scope.$watch('newAccount.zip', function (input) { 68 if ($scope.newAccount.zip != null && input != null) { 69 $scope.newAccount.zip = input.replace(/[^0-9\\.]+/g, ''); 70 } 71 }); 72 $scope.$watch('newAccount.phone', function (input) { 73 if ($scope.newAccount.phone != null && input != null) { 74 75 var cleaned = input.replace(/[^0-9\\.]+/g, ''); 76 var match = cleaned.match(/^(\d{0,3})(\d{0,3})(\d{0,4})$/) 77 if (match) { 78 var formattedPhone = match[1]; 79 if (match[2].length > 0) { 80 formattedPhone += '-' + match[2]; 81 } 82 if (match[3].length > 0) { 83 formattedPhone += '-' + match[3]; 84 } 85 $scope.newAccount.phone = formattedPhone.substr(0, 12); 86 } 87 } 88 }); 89 90 $scope.submitAttempt1 = false; 91 $scope.checkStep1 = function (form) { 92 $scope.submitAttempt1 = true; 93 if (form.$invalid) { 94 return; 95 } 96 $scope.submitAttempt1 = false; 97 $scope.setSection("create2"); 98 }; 99 100 $scope.submitAttempt2 = false; 101 $scope.checkStep2 = function (form) { 102 $scope.submitAttempt2 = true; 103 if (form.$invalid) { 104 return; 105 } 106 if ($scope.newAccount.state == null && $scope.newAccount.country == 1) { 107 return; 108 } 109 $scope.submitAttempt2 = false; 110 $scope.setSection("create3"); 111 }; 112 113 $scope.checkStep3 = function (form) { 114 115 $scope.customAnswers = []; 116 117 $scope.requiredCheckFailed = false; 118 119 jQuery('.customFormItem').each(function () { 120 $scope.customAnswers.push({ detailId: jQuery(this).attr('data-id'), answer: jQuery(this).val() }); 121 }); 122 123 jQuery('.checkboxGroup').each(function () { 124 var vals = []; 125 var detailId = ""; 126 127 var localCheckFailed = jQuery(this).attr('data-required') == "true"; 128 var localId = null; 129 130 jQuery(this).find('.customFormCheckbox').each(function () { 131 132 var dataval = jQuery(this).val().split('|'); 133 detailId = dataval[0]; 134 localId = dataval[0]; 135 136 if (jQuery(this).prop('checked')) { 137 vals.push(dataval[1]); 138 localCheckFailed = false; 139 } 140 }); 141 142 if (localCheckFailed) { 143 $scope.requiredCheckFailed = true; 144 145 jQuery('.custom-feedback[data-id-feedback=' + localId + ']').css('display', 'block'); 146 } else { 147 jQuery('.custom-feedback[data-id-feedback=' + localId + ']').css('display', 'none'); 148 } 149 150 $scope.customAnswers.push({ detailId: detailId, answer: vals.join('|') }); 151 }); 152 153 jQuery('.radioGroup').each(function () { 154 var dataval = []; 155 156 jQuery(this).find('.customFormRadio').each(function () { 157 dataval[0] = jQuery(this).val().split('|')[0]; 158 159 if (jQuery(this).prop('checked')) { 160 dataval = jQuery(this).val().split('|'); 161 } 162 }); 163 164 if (dataval.length == 2) { 165 $scope.customAnswers.push({ detailId: dataval[0], answer: dataval[1] }); 166 } else if (dataval.length == 1) { 167 $scope.customAnswers.push({ detailId: dataval[0], answer: "" }); 168 } 169 }); 170 171 $scope.loopfailed = false; 172 173 angular.forEach($scope.questions, function (question) { 174 var failed = true; 175 176 if (question.required) { 177 var failed = true; 178 179 if (question.detailControlType == 8) { 180 if (!question.attachments) { 181 question.isInvalid = true; 182 } else { 183 if (!question.attachments.length) { 184 question.isInvalid = true; 185 } else { 186 187 var answer = ""; 188 angular.forEach(question.attachments, function (attachment) { 189 190 if (answer != "") { 191 answer += ","; 192 } 193 answer += attachment.uploadedFileId; 194 }); 195 196 $scope.customAnswers.push({ detailId: question.detailId, answer: answer, isUpload: true });
197 failed = false; 198 } 199 } 200 201 202 } else { 203 angular.forEach($scope.customAnswers, function (answer) { 204 question.isInvalid = true; 205 if (answer.detailId == question.detailId && answer.answer.length > 0) { 206 failed = false; 207 question.isInvalid = false; 208 } 209 }); 210 } 211 if (failed) { 212 $scope.loopfailed = true; 213 } 214 } else { 215 failed = false; 216 if (question.detailControlType == 8) { 217 if (!question.attachments) { 218 //do nothing 219 } else { 220 if (!question.attachments.length) { 221 //do nothing 222 } else { 223 var answer = ""; 224 angular.forEach(question.attachments, function (attachment) { 225 if (answer != "") { 226 answer += ","; 227 } 228 answer += attachment.uploadedFileId; 229 }); 230 $scope.customAnswers.push({ detailId: question.detailId, answer: answer, isUpload: true }); 231 failed = false; 232 } 233 } 234 } 235 } 236 237 if (question.removedAttachments) { 238 var removedAnswer = ""; 239 angular.forEach(question.removedAttachments, function (attachment) { 240 if (removedAnswer != "") { 241 removedAnswer += ","; 242 } 243 removedAnswer += attachment.uploadedFileId; 244 }); 245 $scope.customAnswers.push({ detailId: question.detailId, answer: "", removedAnswer: removedAnswer, isUpload: true }); 246 } 247 248 if (failed) { 249 $scope.loopfailed = true; 250 jQuery('.custom-feedback[data-id-feedback=' + question.detailId + ']').css('display', 'block'); 251 } else if (question.detailControlType != 3) { 252 jQuery('.custom-feedback[data-id-feedback=' + question.detailId + ']').css('display', 'none'); 253 } 254 255 }); 256 257 if ($scope.requiredCheckFailed) { 258 return; 259 } 260 261 if ($scope.loopfailed) { 262 return; 263 } 264 265 $scope.newAccount.customAnswers = $scope.customAnswers; 266 267 $scope.ajaxCall('/Customer/PublicSignup', { customerId: $scope.customerId, info: $scope.newAccount }, function (data) { 268 $scope.newAccount = { state: null }; 269 $scope.setSection('createsuccess'); 270 // $scope.$close(); 271 }); 272 } 273 274 $scope.doCreateAccount = function (form) { 275 $scope.submitAttempt2 = true; 276 if (form.$invalid) { 277 return; 278 } 279 if ($scope.newAccount.state == null && !$scope.newAccount.internationalState) { 280 return; 281 } 282 $scope.submitAttempt2 = false; 283 $scope.ajaxCall('/Customer/PublicSignup', { customerId: $scope.customerId, info: $scope.newAccount }, function (data) { 284 $scope.newAccount = { state: null }; 285 $scope.setSection('createsuccess'); 286 // $scope.$close(); 287 }); 288 } 289 290 $scope.doResetPassword = function () { 291 if (brand == "membershine") { 292 $scope.ajaxCall('/LoginService/ResetPasswordMembershineCustomer', { username: $scope.loginDetail
292s.username, customerId: $scope.customerId }, function (data) { 293 //$scope.successMessage('Thank you. We will check our database and send you a link to reset your password.'); 294 $scope.setSection('resetsuccess'); 295 $scope.loginDetails = { username: '', password: '' }; 296 }); 297 } else { 298 $scope.ajaxCall('/LoginService/ResetPasswordHoastartCustomer', { username: $scope.loginDetails.username, customerId: $scope.customerId }, function (data) { 299 //$scope.successMessage('Thank you. We will check our database and send you a link to reset your password.'); 300 $scope.setSection('resetsuccess'); 301 $scope.loginDetails = { username: '', password: '' }; 302 }); 303 } 304 }; 305 306 $scope.inUpload = false; 307 $scope.startFileUpload = function (files) { 308 $scope.inUpload = true; 309 }; 310 311 $scope.successFileUploadCustomMultiple = function (response, field) { 312 $scope.inUpload = false; 313 if (response.data.success) { 314 315 if (!field.attachments) { 316 field.attachments = []; 317 } 318 angular.forEach(response.data.results, function (result) { 319 var folderFile = {}; 320 folderFile.uploadedFileId = result.fileId; 321 folderFile.sizeInt = result.fileSizeBytes; 322 folderFile.name = result.fileName; 323 folderFile.type = result.fileType; 324 325 field.attachments.push(folderFile); 326 }); 327 } else { 328 $scope.errorMessage('One or more files exceeds the maximum file size of 15MB.'); 329 } 330 }; 331 332 $scope.removeFormFile = function (index, field) { 333 if (!field.removedAttachments) { 334 field.removedAttachments = []; 335 } 336 337 field.removedAttachments.push(field.attachments[index]); 338 field.attachments.splice(index, 1); 339 } 340 341 $scope.triggerAccordion = function (detailId) { 342 var accordion = jQuery('.attachmentCollapse[data-item=' + detailId + ']'); 343 if (accordion.hasClass('isExpanded')) { 344 accordion.removeClass('isExpanded').slideUp(); 345 } else { 346 accordion.addClass('isExpanded').slideDown(); 347 } 348 } 349 350 351 352 $scope.emailMessage = function () { 353 $uibModal.open({ 354 templateUrl: 'receiveemailmodal', 355 controller: function ($scope, $timeout) { 356 }, 357 resolve: { 358 } 359 }).result.then(function () { 360 }, function () { 361 362 }); 363 } 364 365 366 367 }) 368 ;
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.