From c24c8589cb889a06914192afe18cd0b0c90bf9e9 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Fri, 6 Nov 2026 22:02:18 -0800 Subject: [PATCH] Hide the opener notice on the popup account picker (#4530) Someone choosing from accounts they've already signed in with doesn't need to be told the site uses Puter. The login and signup screens keep it. --- src/gui/src/UI/Auth/UIAuthAccountPicker.js | 3 ++- src/gui/src/UI/Auth/authFlow.js | 7 +++++-- src/gui/src/UI/Auth/authFlow.test.js | 10 ++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gui/src/UI/Auth/UIAuthAccountPicker.js b/src/gui/src/UI/Auth/UIAuthAccountPicker.js index 5af6fd393..5f459bb2a 100644 --- a/src/gui/src/UI/Auth/UIAuthAccountPicker.js +++ b/src/gui/src/UI/Auth/UIAuthAccountPicker.js @@ -84,7 +84,8 @@ export function pushAccountPickerScreen (flow) { const accounts = Array.isArray(window.logged_in_users) ? window.logged_in_users : []; let h = '
'; - h += authHeadHtml(flow, i18n('sign_in_with_puter', [], false)); + // Everyone here has signed in to Puter before; no need to explain it. + h += authHeadHtml(flow, i18n('sign_in_with_puter', [], false), { openerNotice: false }); h += `'; diff --git a/src/gui/src/UI/Auth/authFlow.js b/src/gui/src/UI/Auth/authFlow.js index ad8eec8f2..5be8bd98e 100644 --- a/src/gui/src/UI/Auth/authFlow.js +++ b/src/gui/src/UI/Auth/authFlow.js @@ -387,9 +387,12 @@ export const joinAuthFlow = () => { * * @param {AuthFlow} flow * @param {string} title Plain text. + * @param {{ openerNotice?: boolean }} [opts] `openerNotice: false` leaves out + * the line explaining that the site uses Puter, for screens shown to someone + * who already has an account here. * @returns {string} */ -export const authHeadHtml = (flow, title) => { +export const authHeadHtml = (flow, title, { openerNotice = true } = {}) => { const opener = window.embedded_in_popup && isAttestedOrigin(window.openerOrigin) ? window.openerOrigin : ''; let h = '
'; h += authLogoHeader({ @@ -399,7 +402,7 @@ export const authHeadHtml = (flow, title) => { openerFallbackSrc: window.icons['website.svg'], }); h += `

${html_encode(title)}

`; - if ( opener ) { + if ( opener && openerNotice ) { h += `

${i18n('popup_opener_uses_puter', [new URL(opener).hostname])}

`; } h += '
'; diff --git a/src/gui/src/UI/Auth/authFlow.test.js b/src/gui/src/UI/Auth/authFlow.test.js index c1f5dab2c..f87875df0 100644 --- a/src/gui/src/UI/Auth/authFlow.test.js +++ b/src/gui/src/UI/Auth/authFlow.test.js @@ -250,6 +250,16 @@ describe('authHeadHtml', () => { expect($dialog_head.find('a')).toHaveLength(0); expect($dialog_head.find('.auth-logo').attr('alt')).toBe(''); }); + + it('explains the opener in a sign-in popup unless told not to', () => { + window.embedded_in_popup = true; + window.openerOrigin = 'https://builder.puter.com'; + const flow = openAuthFlow(); + const $notice = $(authHeadHtml(flow, 'Log in')).find('.auth-opener-notice'); + expect($notice).toHaveLength(1); + expect($notice.text()).toContain('builder.puter.com'); + expect($(authHeadHtml(flow, 'Log in', { openerNotice: false })).find('.auth-opener-notice')).toHaveLength(0); + }); }); describe('authFlowOptions', () => {