fix demo index

This commit is contained in:
Eugenio Romano
2016-08-25 11:47:49 +01:00
parent bec481e81e
commit 4406024330
6 changed files with 77 additions and 74 deletions

View File

@@ -30,12 +30,12 @@ import {
@Component({
selector: 'my-app',
template: `
<label for="token"><b>Insert a valid access token / ticket:</b></label><br>
<input id="token" type="text" size="48" (change)="updateToken();documentList.reload()" [(ngModel)]="token"><br>
<label for="token"><b>Insert the ip of your Alfresco instance:</b></label><br>
<input id="token" type="text" size="48" (change)="updateHost();documentList.reload()" [(ngModel)]="ecmHost"><br><br>
<label for="ticket"><b>Insert a valid access ticket / ticket:</b></label><br>
<input id="ticket" type="text" size="48" (change)="updateTicket();documentList.reload()" [(ngModel)]="ticket"><br>
<label for="host"><b>Insert the ip of your Alfresco instance:</b></label><br>
<input id="host" type="text" size="48" (change)="updateHost();documentList.reload()" [(ngModel)]="ecmHost"><br><br>
<div *ngIf="!authenticated" style="color:#FF2323">
Authentication failed to ip {{ ecmHost }} with user: admin, admin, you can still try to add a valid token to perform
Authentication failed to ip {{ ecmHost }} with user: admin, admin, you can still try to add a valid ticket to perform
operations.
</div>
<hr>
@@ -54,19 +54,19 @@ class MyDemoApp {
ecmHost: string = 'http://127.0.0.1:8080';
token: string;
ticket: string;
constructor(private authService: AlfrescoAuthenticationService,
private settingsService: AlfrescoSettingsService) {
settingsService.ecmHost = this.ecmHost;
if (this.authService.getTicket()) {
this.token = this.authService.getTicket();
if (this.authService.getTicketEcm()) {
this.ticket = this.authService.getTicketEcm();
}
}
public updateToken(): void {
localStorage.setItem('token', this.token);
public updateTicket(): void {
localStorage.setItem('ticket-ECM', this.ticket);
}
public updateHost(): void {
@@ -80,9 +80,9 @@ class MyDemoApp {
login() {
this.authService.login('admin', 'admin').subscribe(
token => {
console.log(token);
this.token = token;
ticket => {
console.log(ticket);
this.ticket = this.authService.getTicketEcm();
this.authenticated = true;
},
error => {