-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from xaun/remove-proxy
Remove proxy, config angular devise for cors as default
- Loading branch information
Showing
7 changed files
with
69 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// ------------------------------------------------------- | ||
// Impac! Angular DevSession Service | ||
// -------- | ||
// Providing CSRF Support for Impac! Workspace. | ||
// ------------------------------------------------------- | ||
angular.module('impacWorkspace').service('DevSession', function ($log, $http, $cookies, CSRF, DevSettings) { | ||
var _self = this; | ||
|
||
// Create a session and xsrf token - ping mnoe api so we get a valid XSRF cookie. | ||
this.create = function () { | ||
return $http.get(DevSettings.defaults().mnoeUrl.host + '/mnoe/auth/users/sign_in.json') | ||
.success(function() { | ||
_self.setCsrfHttpHeader(); | ||
}); | ||
}; | ||
|
||
// Angular Devise methods (e.g `Auth.currentUser()`) generate new sessions, this keeps the | ||
// default http headers up to date, ensuring the session is maintained. | ||
this.update = function () { | ||
this.setCsrfHttpHeader(); | ||
}; | ||
|
||
// Set stored XSRF cookie as $http headers common. | ||
this.setCsrfHttpHeader = function () { | ||
$http.defaults.headers.common[CSRF.headerTokenKey] = $cookies.get(CSRF.cookieTokenKey); | ||
}; | ||
|
||
return this; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters