Skip to content

Commit f52da15

Browse files
authored
fix(auth): move OAuth account controls below consent actions (#7575)
1 parent 8adb986 commit f52da15

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

apps/sim/app/(auth)/oauth/consent/consent-view.test.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,13 @@ describe('OAuth consent view', () => {
6868
vi.useRealTimers()
6969
})
7070

71-
it('shows the registered app, account and destination with one row per distinct capability', () => {
71+
it('shows the account below the decisions without a CLI destination sentence', () => {
7272
expect(container.querySelector('h1')?.textContent).toBe('Authorize Sim CLI')
7373
expect(container.textContent).toContain('Continuing as test@example.com.')
74-
expect(container.textContent).toContain('Returns to this computer.')
74+
expect(container.textContent).not.toContain('Returns to this computer.')
75+
expect(
76+
Array.from(container.querySelectorAll('button')).map((element) => element.textContent)
77+
).toEqual(['Allow', 'Deny', 'Use another account'])
7578
expect(container.querySelectorAll('li')).toHaveLength(2)
7679
expect(button('Allow').disabled).toBe(false)
7780
expect(button('Deny').disabled).toBe(false)

apps/sim/app/(auth)/oauth/consent/consent-view.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,6 @@ export function OAuthConsentView({
152152
))}
153153
</ul>
154154
)}
155-
<p className='break-words text-center text-[var(--text-muted)] text-caption'>
156-
Continuing as {email}.{' '}
157-
<AuthTextLink onClick={changeAccount} disabled={isPending}>
158-
{switchAccount.isPending ? 'Signing out…' : 'Use another account'}
159-
</AuthTextLink>
160-
</p>
161155
<AuthSubmitButton
162156
type='button'
163157
loading={consent.isPending && consent.variables === true}
@@ -177,7 +171,7 @@ export function OAuthConsentView({
177171
>
178172
{consent.isPending && consent.variables === false ? 'Declining…' : 'Deny'}
179173
</Chip>
180-
{destination && (
174+
{!isCli && destination && (
181175
<p className='break-words text-center text-[var(--text-muted)] text-caption'>
182176
Returns to {destination}.
183177
</p>
@@ -192,6 +186,12 @@ export function OAuthConsentView({
192186
</AuthFormMessage>
193187
</div>
194188
)}
189+
<p className='break-words text-center text-[var(--text-muted)] text-caption'>
190+
Continuing as {email}.{' '}
191+
<AuthTextLink onClick={changeAccount} disabled={isPending}>
192+
{switchAccount.isPending ? 'Signing out…' : 'Use another account'}
193+
</AuthTextLink>
194+
</p>
195195
</div>
196196
</div>
197197
)

0 commit comments

Comments
 (0)