Disallow creating accounts as a guest. #52

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

View File

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

View File

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

View File

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