harbor/static/resources/js/services/user/services.sign-in.js

31 lines
778 B
JavaScript
Raw Normal View History

(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}
});
}
}
})();