diff options
| author | Adam Soltys <[email protected]> | 2026-09-14 19:14:38 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-09-14 19:14:38 -0700 |
| commit | 4409629ab28372def6afb07c2fb1e124a58ab171 (patch) | |
| tree | 65474cfb28b7ce8fd1602e141aac01cacef52d8a /src/features | |
| parent | de9efec9205f5faa0245d1d0182e87931f2d26c2 (diff) | |
| download | coinosv3-4409629ab28372def6afb07c2fb1e124a58ab171.tar.gz coinosv3-4409629ab28372def6afb07c2fb1e124a58ab171.zip | |
Logging out leaves one identity, not everyone on the device.
With several identities signed in, the profile's Log out now signs out
only the current one: its accounts leave the session, directory, cache
and vault, the others stay put, and the next identity takes the screen.
The confirmation names who is leaving and says whether they can sign
straight back in (a nostr login) or need their recovery phrase (a bare
seed). Logging out of every account is a second, explicit button. Alone
on the device, Log out is unchanged.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Diffstat (limited to 'src/features')
| -rw-r--r-- | src/features/messages.js | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/features/messages.js b/src/features/messages.js index 127dc08..e2d09b6 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -4045,19 +4045,30 @@ export function messagesFeature(ctx) { onClick: () => { ui.logoutConfirm = null; ctx.logoutForget(); }, }, t('clearAll')), h('button', { class: 'btn-ghost btn-block', onClick: () => { ui.logoutConfirm = true; render(); } }, t('back'))) - : h('div', { class: 'card col confirm-pop', style: 'gap:10px' }, - h('h3', { style: 'margin:0' }, t('logout') + '?'), - h('p', { class: 'small muted', style: 'margin:0' }, t('logoutPopBlurb')), - h('button', { class: 'btn-primary btn-block', onClick: () => { + : (() => { + // With other identities signed in, logging out means THIS one + // leaves and the rest stay put; logging out of everything is + // the second, explicit choice. Alone on the device, it's the + // plain log-out it always was. + const others = ctx.identities ? ctx.identities().filter((x) => !x.active) : []; + const one = others.length > 0 && !!ctx.signOutIdentity; + const leave = (fn) => () => { ui.logoutConfirm = null; ui.profilePk = null; ui.profEdit = null; ui.profEditFilled = false; - ctx.logout && ctx.logout(); - } }, t('logout')), + fn && fn(); + }; + return h('div', { class: 'card col confirm-pop', style: 'gap:10px' }, + h('h3', { style: 'margin:0' }, (one ? t('logoutOne', { name: displayName(pk) }) : t('logout')) + '?'), + h('p', { class: 'small muted', style: 'margin:0' }, + one ? t(ctx.identityRecoverable && ctx.identityRecoverable() ? 'logoutOneBlurbLogin' : 'logoutOneBlurbSeed') : t('logoutPopBlurb')), + h('button', { class: 'btn-primary btn-block', onClick: leave(one ? ctx.signOutIdentity : ctx.logout) }, t('logout')), + one ? h('button', { class: 'btn-block', onClick: leave(ctx.logout) }, t('logoutAll')) : null, ctx.logoutForget ? h('button', { class: 'btn-block', style: 'color:var(--red,#c0392b)', onClick: () => { ui.logoutConfirm = 'forget'; render(); }, }, t('logoutForget')) : null, - h('button', { class: 'btn-ghost btn-block', onClick: () => { ui.logoutConfirm = null; render(); } }, t('back')))); + h('button', { class: 'btn-ghost btn-block', onClick: () => { ui.logoutConfirm = null; render(); } }, t('back'))); + })()); // The identity switcher: every account signed in on this device as an // avatar + name row (tap = switch, nothing logged out), and the door to // add a new one. |
