This commit is contained in:
Mario Romano
2016-09-26 21:33:30 +01:00
parent dea16dabe6
commit 16d8c55f62
5 changed files with 41 additions and 1 deletions

View File

@@ -3,3 +3,7 @@
display: none;
}
}
.mdl-layout-title{
font-size: 17px;
}

View File

@@ -61,6 +61,11 @@
<input type="text" class="mdl-textfield__input" id="bpmHost" data-automation-id="bpmHost"
tabindex="1" (change)="onChangeBPMHost($event)" value="{{bpmHost}}"/>
</nav>
<span class="mdl-layout-title">CSRF Token Disabled</span>
<nav class="mdl-navigation">
<input type="text" class="mdl-textfield__input" id="csrfDisabled" data-automation-id="csrfDisabled"
tabindex="1" (change)="onChangeCsrf($event)" value="{{csrfDisabled}}"/>
</nav>
</div>
<main class="mdl-layout__content">
<div class="page-content">

View File

@@ -37,6 +37,7 @@ export class AppComponent {
ecmHost: string = 'http://' + window.location.hostname + ':8080';
bpmHost: string = 'http://' + window.location.hostname + ':9999';
csrfDisabled: boolean = false;
constructor(public auth: AlfrescoAuthenticationService,
public router: Router,
@@ -44,6 +45,7 @@ export class AppComponent {
public alfrescoSettingsService: AlfrescoSettingsService) {
this.setEcmHost();
this.setBpmHost();
this.setCsrfToken();
this.translate = translate;
this.translate.addTranslationFolder();
@@ -63,6 +65,13 @@ export class AppComponent {
localStorage.setItem(`bpmHost`, this.bpmHost);
}
public onChangeCsrf(event: KeyboardEvent): void {
console.log((<HTMLInputElement>event.target).value);
this.csrfDisabled = !!(<HTMLInputElement>event.target).value;
this.alfrescoSettingsService.csrfDisabled = this.csrfDisabled;
localStorage.setItem(`csrfDisabled`, this.csrfDisabled.toString());
}
isLoggedIn(): boolean {
return this.auth.isLoggedIn();
}
@@ -120,4 +129,13 @@ export class AppComponent {
this.alfrescoSettingsService.bpmHost = this.bpmHost;
}
}
private setCsrfToken() {
if (localStorage.getItem(`csrfDisabled`)) {
this.alfrescoSettingsService.bpmHost = localStorage.getItem(`csrfDisabled`);
this.csrfDisabled = !!localStorage.getItem(`csrfDisabled`);
} else {
this.alfrescoSettingsService.csrfDisabled = this.csrfDisabled;
}
}
}