[ADF-2139] extra cookie availability check (#2865)

* extra cookie availability check

* code style and test fixes

* unit tests
This commit is contained in:
Denys Vuika
2018-01-31 17:37:42 +00:00
committed by Eugenio Romano
parent 900fd70d63
commit 49456b3fcd
4 changed files with 59 additions and 5 deletions

View File

@@ -96,7 +96,7 @@ export class AuthenticationService {
*
* @returns {boolean}
*/
private isRememberMeSet(): boolean {
isRememberMeSet(): boolean {
return (this.cookie.getItem(REMEMBER_ME_COOKIE_KEY) === null) ? false : true;
}
@@ -200,7 +200,10 @@ export class AuthenticationService {
* @returns {boolean}
*/
isEcmLoggedIn(): boolean {
return this.isRememberMeSet() && this.alfrescoApi.getInstance().ecmAuth && !!this.alfrescoApi.getInstance().ecmAuth.isLoggedIn();
if (this.cookie.isEnabled() && !this.isRememberMeSet()) {
return false;
}
return this.alfrescoApi.getInstance().ecmAuth && !!this.alfrescoApi.getInstance().ecmAuth.isLoggedIn();
}
/**
@@ -209,7 +212,10 @@ export class AuthenticationService {
* @returns {boolean}
*/
isBpmLoggedIn(): boolean {
return this.isRememberMeSet() && this.alfrescoApi.getInstance().bpmAuth && !!this.alfrescoApi.getInstance().bpmAuth.isLoggedIn();
if (this.cookie.isEnabled() && !this.isRememberMeSet()) {
return false;
}
return this.alfrescoApi.getInstance().bpmAuth && !!this.alfrescoApi.getInstance().bpmAuth.isLoggedIn();
}
/**