mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-09 20:21:53 +01:00
31 lines
778 B
JavaScript
31 lines
778 B
JavaScript
(function() {
|
|
|
|
'use strict';
|
|
|
|
angular
|
|
.module('harbor.services.user')
|
|
.factory('SignInService', SignInService);
|
|
|
|
SignInService.$inject = ['$http', '$log'];
|
|
|
|
function SignInService($http, $log) {
|
|
|
|
return SignIn;
|
|
|
|
function SignIn(principal, password) {
|
|
return $http({
|
|
method: 'POST',
|
|
url: '/login',
|
|
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
|
|
transformRequest: function(obj) {
|
|
var str = [];
|
|
for(var p in obj) {
|
|
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
|
|
}
|
|
return str.join("&");
|
|
},
|
|
data: {'principal': principal, 'password': password}
|
|
});
|
|
}
|
|
}
|
|
})(); |