2016-04-13 12:55:05 +02:00
|
|
|
(function() {
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
angular
|
|
|
|
.module('harbor.services.user')
|
|
|
|
.factory('SignInService', SignInService);
|
|
|
|
|
|
|
|
SignInService.$inject = ['$http', '$log'];
|
|
|
|
|
|
|
|
function SignInService($http, $log) {
|
|
|
|
|
|
|
|
return SignIn;
|
|
|
|
|
2016-05-01 19:46:50 +02:00
|
|
|
function SignIn(principal, password) {
|
|
|
|
return $http({
|
|
|
|
method: 'POST',
|
|
|
|
url: '/login',
|
|
|
|
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
|
|
|
|
transformRequest: function(obj) {
|
|
|
|
var str = [];
|
2016-05-23 12:29:17 +02:00
|
|
|
for(var p in obj) {
|
|
|
|
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
|
|
|
|
}
|
2016-05-01 19:46:50 +02:00
|
|
|
return str.join("&");
|
|
|
|
},
|
|
|
|
data: {'principal': principal, 'password': password}
|
|
|
|
});
|
2016-04-13 12:55:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})();
|