mirror of
https://github.com/OpenLiberty/liberty-bikes.git
synced 2025-01-18 10:23:58 +08:00
Merge pull request #114 from ryanesch/googleusername
For Google Auth, add register username panel
This commit is contained in:
commit
a79b50ee55
@ -33,7 +33,7 @@
|
|||||||
<input type="text" id="username" name="username" [(ngModel)]="username" />
|
<input type="text" id="username" name="username" [(ngModel)]="username" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<button type="button" (click)="loginAsGuest(username)">Sign In As Guest</button>
|
<button type="button" id="signin" (click)="loginAsGuest(username)">Sign In As Guest</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<button type="button" (click)="cancelLogin()">Cancel</button>
|
<button type="button" (click)="cancelLogin()">Cancel</button>
|
||||||
|
@ -162,6 +162,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
showGuestLogin() {
|
showGuestLogin() {
|
||||||
this.pane = 'center';
|
this.pane = 'center';
|
||||||
|
document.getElementById("signin").innerHTML="Sign In As Guest";
|
||||||
}
|
}
|
||||||
|
|
||||||
setQueueOnMessage() {
|
setQueueOnMessage() {
|
||||||
@ -208,7 +209,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async loginAsGuest(username: string) {
|
async loginAsGuest(username: string) {
|
||||||
if (await this.createUser(username, null))
|
if (await this.createUser(username, sessionStorage.getItem('userId')))
|
||||||
this.pane = 'right';
|
this.pane = 'right';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,16 +219,14 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': 'Bearer ' + `${jwt}`
|
'Authorization': 'Bearer ' + `${jwt}`
|
||||||
}) }).toPromise();
|
}) }).toPromise();
|
||||||
|
sessionStorage.setItem('userId', user.id);
|
||||||
if (user.exists === 'true') {
|
if (user.exists === 'true') {
|
||||||
sessionStorage.setItem('username', user.username);
|
sessionStorage.setItem('username', user.username);
|
||||||
sessionStorage.setItem('userId', user.id);
|
|
||||||
this.player.name = user.username;
|
this.player.name = user.username;
|
||||||
this.pane = 'right';
|
this.pane = 'right';
|
||||||
} else {
|
} else {
|
||||||
var username = prompt("Choose a username:", "");
|
this.pane = 'center';
|
||||||
if (await this.createUser(username, user.id)) {
|
document.getElementById("signin").innerHTML="register username";
|
||||||
this.pane = 'right';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,6 +271,8 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cancelLogin() {
|
cancelLogin() {
|
||||||
|
sessionStorage.removeItem('username');
|
||||||
|
sessionStorage.removeItem('userId');
|
||||||
this.pane = 'left';
|
this.pane = 'left';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user