fix(shared/auth/icon): Fixed lots of small things
Icons: Fixed docker-compose to force JWT_SECRET for now Auth: Fixed Guest Login to actually work Auth: Added `Login as Guest` in the login_demo page Shared: Fixed db/user + uuid modules
This commit is contained in:
parent
5306ccfc60
commit
2074f8d8f1
6 changed files with 51 additions and 11 deletions
|
|
@ -20,6 +20,7 @@
|
|||
<br />
|
||||
<br />
|
||||
<button id="b-login">Login</button>
|
||||
<button id="b-login-guest">Login as Guest</button>
|
||||
<br />
|
||||
<button id="b-logout">Logout</button>
|
||||
<br />
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ const iOtp = document.querySelector('#i-otp');
|
|||
|
||||
const bOtpSend = document.querySelector('#b-otpSend');
|
||||
const bLogin = document.querySelector('#b-login');
|
||||
const bLoginGuest = document.querySelector('#b-login-guest');
|
||||
const bLogout = document.querySelector('#b-logout');
|
||||
const bSignin = document.querySelector('#b-signin');
|
||||
const bWhoami = document.querySelector('#b-whoami');
|
||||
|
|
@ -27,6 +28,16 @@ function setResponse(obj) {
|
|||
}
|
||||
let otpToken = null;
|
||||
|
||||
bLoginGuest.addEventListener('click', async () => {
|
||||
const res = await fetch('/api/auth/guest', { method: 'POST' });
|
||||
const json = await res.json();
|
||||
|
||||
setResponse(json);
|
||||
if (json.kind === 'success') {
|
||||
if (json?.payload?.token) {document.cookie = `token=${json?.payload?.token}`;}
|
||||
}
|
||||
});
|
||||
|
||||
bOtpSend.addEventListener('click', async () => {
|
||||
const res = await fetch('/api/auth/otp', { method: 'POST', body: JSON.stringify({ code: iOtp.value, token: otpToken }), headers });
|
||||
const json = await res.json();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue