mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-05-06 06:04:33 +00:00
Workers have a different command
This commit is contained in:
@@ -23,3 +23,4 @@ worker:
|
|||||||
restart: always
|
restart: always
|
||||||
env_file:
|
env_file:
|
||||||
- ./prod.env
|
- ./prod.env
|
||||||
|
command: bundle exec rake jobs:work RAILS_ENV=production
|
||||||
|
|||||||
49
frontend/app/js/auth-service.js
Normal file
49
frontend/app/js/auth-service.js
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
app.factory('AuthenticationService',
|
||||||
|
['Base64', '$http', '$cookieStore', '$rootScope', '$timeout',
|
||||||
|
function (Base64, $http, $cookieStore, $rootScope, $timeout) {
|
||||||
|
var service = {};
|
||||||
|
|
||||||
|
service.Login = function (username, password, callback) {
|
||||||
|
|
||||||
|
/* Dummy authentication for testing, uses $timeout to simulate api call
|
||||||
|
----------------------------------------------*/
|
||||||
|
// $timeout(function(){
|
||||||
|
// var response = { success: username === 'test' && password === 'test' };
|
||||||
|
// if(!response.success) {
|
||||||
|
// response.message = 'Username or password is incorrect';
|
||||||
|
// }
|
||||||
|
// callback(response);
|
||||||
|
// }, 1000);
|
||||||
|
|
||||||
|
|
||||||
|
/* Use this for real authentication
|
||||||
|
----------------------------------------------*/
|
||||||
|
$http.post('/api/authenticate', { username: username, password: password })
|
||||||
|
.success(function (response) {
|
||||||
|
callback(response);
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
service.SetCredentials = function (username, password) {
|
||||||
|
var authdata = Base64.encode(username + ':' + password);
|
||||||
|
|
||||||
|
$rootScope.globals = {
|
||||||
|
currentUser: {
|
||||||
|
username: username,
|
||||||
|
authdata: authdata
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.defaults.headers.common['Authorization'] = 'Basic ' + authdata; // jshint ignore:line
|
||||||
|
$cookieStore.put('globals', $rootScope.globals);
|
||||||
|
};
|
||||||
|
|
||||||
|
service.ClearCredentials = function () {
|
||||||
|
$rootScope.globals = {};
|
||||||
|
$cookieStore.remove('globals');
|
||||||
|
$http.defaults.headers.common.Authorization = 'Basic ';
|
||||||
|
};
|
||||||
|
|
||||||
|
return service;
|
||||||
|
}]);
|
||||||
Reference in New Issue
Block a user