1(function (modules) { 2 modules.push('app.controllers'); 3 var app = angular.module('app.controllers', ['app.service.facebook']); 4 5 app.controller('UserLoginCtrl', ['$scope', '$http', 'appTranslator', '$timeout', 'appFacebook', '$window', 6 function ($scope, $http, appTranslator, $timeout, appFacebook, $window) { 7 var lastServerErrors = {}; 8 $scope.data = {}; 9 10 $scope.facebookLogin = function (url) { 11 appFacebook.init(function () { 12 13 var data = { 14 provider: 'facebook', 15 token: appFacebook.getToken() 16 }; 17 18 $http.post(url, data) 19 .success(function (data) { 20 if (data.url) { 21 $window.location = data.url; 22 } 23 if (data.success) { 24 $window.location.reload(); 25 } 26 }); 27 }); 28 }; 29 30 /*setTimeout( 31 function() 32 { 33 if ( $( "#preloadDiv" ).length ) { 34 $( "#preloadDiv" ).hide(); 35 }; 36 37 if ( $( "#ConnectloadingDiv" ).length ) { 38 $( "#ConnectloadingDiv" ).hide(); 39 }; 40 41 }, 5000);*/ 42 43 $scope.submit = function (valid, url) { 44 if (!valid) { 45 return; 46 } 47 48 if ( $( "#preloadDiv" ).length ) { 49 50 $( "#preloadDiv" ).show(); 51 52 } 53 54 if ( $( "#ConnectloadingDiv" ).length ) { 55 $( "#ConnectloadingDiv" ).show(); 56 }; 57 58 $scope.userLoginForm.$invalid = true; 59 60 $("#userLoginFormValid").hide(); 61 62 63 $http.post(url, $scope.data) 64 .success(function (data) { 65 if (data.errors) { 66 lastServerErrors = data.errors; 67 angular.forEach(lastServerErrors, function (value, key) { 68 $scope.userLoginForm[key].$setValidity('server', false); 69 }); 70 $("#userLoginFormValid").show(); 71 $scope.userLoginForm.$invalid = false; 72 73 if ( $( "#preloadDiv" ).length ) { 74 $( "#preloadDiv" ).hide(); 75 } 76 77 if ( $( "#ConnectloadingDiv" ).length ) { 78 $( "#ConnectloadingDiv" ).hide(); 79 }; 80 } 81 82 if (data.url) { 83 $timeout(function () { 84 window.location = data.url; 85 }); 86 } 87 }); 88 }; 89 90 $scope.errorMsg = function (name) { 91 var msg = null; 92 angular.forEach($scope.userLoginForm[name].$error, function (val, key) { 93 if (key == 'server') { 94 msg = lastServerErrors[name]; 95 } else { 96 msg = appTranslator.msg('error_' + key); 97 } 98 }); 99 return msg; 100 }; 101 102 }]); 103 104 app.controller('RecruiterLoginCtrl', ['$scope', '$http', 'appTranslator', '$timeout', 105 function ($scope, $http, appTranslator, $timeout) { 106 var lastServerErrors = {}; 107 $scope.data = { 108 rememberMe: true 109 }; 110 111 $scope.submit = function (valid, url) { 112 if (!valid) { 113 return; 114 } 115 $scope.recruiterLoginForm.$invalid = true; 116 $("div[id^='loodingImg']").show(); 117 $http.post(url, $scope.data) 118 .success(function (data) { 119
120 $scope.recruiterLoginForm.$invalid = false; 121 $("div[id^='loodingImg']").hide(); 122 if (data.errors) { 123 lastServerErrors = data.errors; 124 angular.forEach(lastServerErrors, function (value, key) { 125 $scope.recruiterLoginForm[key].$setValidity('server', false); 126 }); 127 } 128 129 if (data.url) { 130 $timeout(function () { 131 window.location = data.url; 132 }); 133 } 134 }); 135 }; 136 137 $scope.errorMsg = function (name) { 138 var msg = null; 139 angular.forEach($scope.recruiterLoginForm[name].$error, function (val, key) { 140 if (key == 'server') { 141 msg = lastServerErrors[name]; 142 } else { 143 msg = appTranslator.msg('error_' + key); 144 } 145 }); 146 return msg; 147 }; 148 149 }]); 150}(APP_MODULES));
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.