Skip to content

Updated device auth#1386

Merged
david-crespo merged 7 commits into
mainfrom
updated-device-auth
Mar 8, 2023
Merged

Updated device auth#1386
david-crespo merged 7 commits into
mainfrom
updated-device-auth

Conversation

@benjaminleonard

Copy link
Copy Markdown
Contributor

First pass of visual update of device auth page and switching to manual entry of user_code.

CleanShot 2023-03-08 at 18 38 46

Fixes #999

@vercel

vercel Bot commented Mar 8, 2023

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
console-ui-storybook ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 8, 2023 at 11:48PM (UTC)

Comment thread app/pages/DeviceAuthVerifyPage.tsx Outdated
@@ -1,49 +1,79 @@
import { useNavigate, useSearchParams } from 'react-router-dom'
import { useState } from 'react'
import AuthCode from 'react-auth-code-input'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory we could do this ourselves, but the library has no dependencies and is only 1kb after bundling. It handles a range of behaviours like pasting a code directly in and dealing with the individual inputs.

@david-crespo

Copy link
Copy Markdown
Collaborator

Hot damn. Very snazzy.

@david-crespo

Copy link
Copy Markdown
Collaborator

Switched to our own copy with credit to the source. Didn't get the inserted dash working. The implementation assumes that nextElementSibling and previousElementSibling are inputs, so it seems like the thing to do would be to stick the - in an after on the desired input. But I couldn't get it to show up. I was able to put a margin on the correct input but the dash wouldn't appear.

I also tried making it find the next input (i.e., not care that there are garbage spans around)

function getNextInputSibling(el: Element): HTMLInputElement | null {
  const next = el.nextElementSibling
  if (!next) return null

  return next.tagName === 'input' ? (next as HTMLInputElement) : getNextInputSibling(next)
}

but I couldn't get that to work either. In any case we can figure this out later.

@david-crespo

Copy link
Copy Markdown
Collaborator

@david-crespo david-crespo marked this pull request as ready for review March 8, 2023 22:04
@david-crespo

Copy link
Copy Markdown
Collaborator

Ok, I got it.

@david-crespo david-crespo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm satisfied. I'll let you make sure the new dash is visually up to par.

image

@david-crespo

Copy link
Copy Markdown
Collaborator

Also ready to accept social security numbers.

image

@david-crespo david-crespo force-pushed the updated-device-auth branch from 724dcf6 to 8938c6d Compare March 8, 2023 23:47
@david-crespo david-crespo enabled auto-merge (squash) March 8, 2023 23:50
@david-crespo david-crespo merged commit 7b52d27 into main Mar 8, 2023
@david-crespo david-crespo deleted the updated-device-auth branch March 8, 2023 23:52
@benjaminleonard

Copy link
Copy Markdown
Contributor Author

Lovely jubbly, thanks for those tweaks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Manual entry of user_code for device auth

2 participants