Disallow creating accounts as a guest.

This commit is contained in:
Cory McWilliams 2024-05-14 12:41:17 -04:00
parent 46e711f0a5
commit f79d7b35a4
3 changed files with 6 additions and 3 deletions
apps/identity
core

View File

@ -78,7 +78,7 @@ async function main() {
alert('Successfully created: ' + id); alert('Successfully created: ' + id);
await tfrpc.rpc.reload(); await tfrpc.rpc.reload();
} catch (e) { } catch (e) {
alert('Error creating identity: ' + e); alert('Error creating identity: ' + e.message);
} }
} }
handler.hide_id = function hide_id(event, element) { handler.hide_id = function hide_id(event, element) {

View File

@ -208,7 +208,7 @@ class TfNavigationElement extends LitElement {
</div> </div>
</div> </div>
`; `;
} else { } else if (this.credentials?.session?.name && this.credentials.session.name !== 'guest') {
return html` return html`
<link type="text/css" rel="stylesheet" href="/static/w3.css" /> <link type="text/css" rel="stylesheet" href="/static/w3.css" />
<button <button

View File

@ -577,7 +577,8 @@ async function getProcessBlob(blobId, key, options) {
if ( if (
process.credentials && process.credentials &&
process.credentials.session && process.credentials.session &&
process.credentials.session.name process.credentials.session.name &&
process.credentials.session.name !== 'guest'
) { ) {
let id = ssb.createIdentity(process.credentials.session.name); let id = ssb.createIdentity(process.credentials.session.name);
await process.sendIdentities(); await process.sendIdentities();
@ -595,6 +596,8 @@ async function getProcessBlob(blobId, key, options) {
] ]
); );
return id; return id;
} else {
throw new Error('Must be signed-in to create an account.');
} }
}; };
if (process.credentials?.permissions?.administration) { if (process.credentials?.permissions?.administration) {