Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Merge pull request #443 from hpcloud/session-name
Browse files Browse the repository at this point in the history
LGTM
  • Loading branch information
wchrisjohnson committed Jul 8, 2016
2 parents fb63b0d + e4cfc1a commit 1144ce2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
15 changes: 11 additions & 4 deletions src/app/api/account/account.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
this.$httpParamSerializer = $httpParamSerializer;
this.$q = $q;
this.$cookies = $cookies;
this.sessionName = 'stackato-console-session';
}

angular.extend(AccountApi.prototype, {
Expand Down Expand Up @@ -83,13 +84,19 @@
* @public
*/
verifySession: function () {
if (this.$cookies.get('portal-session')) {
if (this.$cookies.get(this.sessionName)) {
return this.$http.get('/pp/v1/auth/session/verify');
}
return this.$q(function (resolve, reject) {
reject({});
});
return this.$q.reject(this.sessionName + ' cookie missing!');
},

userInfo: function () {
if (this.$cookies.get(this.sessionName)) {
return this.$http.get('/pp/v1/userinfo');
}
return this.$q.reject(this.sessionName + ' cookie missing!');
}

});

})();
3 changes: 2 additions & 1 deletion src/app/model/account/account.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@
* @private
*/
onLoggedOut: function () {
this.$cookies.remove('portal-session');
var sessionName = this.apiManager.retrieve('app.api.account').sessionName;
this.$cookies.remove(sessionName);
this.loggedIn = false;
delete this.data;
}
Expand Down

0 comments on commit 1144ce2

Please sign in to comment.