Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow phone auth via CodeUI #107

Merged
merged 4 commits into from
Dec 26, 2024

Conversation

xinha-sh
Copy link
Contributor

@xinha-sh xinha-sh commented Dec 23, 2024

Current Code UI allows for only email based auth

<input
  data-component="input"
  autofocus
  type="email"
  name="email"
  required
  placeholder={copy.email_placeholder}
/>

With slight modification it can used to allow phone based auth as well.

<input
  data-component="input"
  autofocus
  type={props.inputOptions?.inputType ?? "email"}
  name={props.inputOptions?.inputName ?? "email"}
  pattern={props.inputOptions?.inputPattern ?? undefined}
  title={props.inputOptions?.inputTitle ?? undefined}
  required
  placeholder={copy.email_placeholder}
/>

Have added two additional attributes pattern and title in-order to allow input validation based on custom requirements.

inputType can be tel, text or email

Also added inputmode and autocomplete to autoread OTP/code in mobile browsers

Copy link

changeset-bot bot commented Dec 23, 2024

🦋 Changeset detected

Latest commit: 5a5f48d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@openauthjs/openauth Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@xinha-sh xinha-sh force-pushed the feature-dynamic-code-adapter branch from 18219ae to e987a42 Compare December 23, 2024 04:43
@xinha-sh xinha-sh changed the title Allow input field modification for code ui Allow phone auth via CodeUI Dec 23, 2024
@xinha-sh xinha-sh force-pushed the feature-dynamic-code-adapter branch from e987a42 to 2a89ac6 Compare December 23, 2024 05:03
@thdxr
Copy link
Contributor

thdxr commented Dec 26, 2024

thanks! i ended up simplifying the PR to a single option - we try to keep the options minimal until we have an overwhelming request for customization

@thdxr thdxr merged commit ca0df5d into openauthjs:master Dec 26, 2024
@xinha-sh
Copy link
Contributor Author

thanks! i ended up simplifying the PR to a single option - we try to keep the options minimal until we have an overwhelming request for customization

Just for context, I added that because I used one Codeadapter for both email and phone. And in auth handler fn I used to check the input value, if it was email I used to send Code via email, else Mobile provider.

jayair added a commit that referenced this pull request Jan 1, 2025
* allow input field modification for code ui

* use autocomplete as one-time-code for input type tel

* simplify options

* ui: support phone mode for code ui

---------

Co-authored-by: Dax Raad <[email protected]>
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.

2 participants