From efef688324cf98fc96084259b3c616951023a9fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mih=C3=A1ly=20Lengyel?= Date: Fri, 6 Oct 2023 08:34:56 +0200 Subject: [PATCH] feat: add autocomplete attributes on passwordless form fields (#747) * feat: add autocomplete attributes on passwordless form fields * chore: bump version --------- Co-authored-by: Rishabh Poddar --- CHANGELOG.md | 6 +++++- lib/build/passwordless-shared3.js | 6 ++++++ .../passwordless/components/themes/signInUp/emailForm.tsx | 1 + .../components/themes/signInUp/emailOrPhoneForm.tsx | 3 +++ .../passwordless/components/themes/signInUp/phoneForm.tsx | 1 + .../components/themes/signInUp/userInputCodeForm.tsx | 1 + 6 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a93efff0d..88a44c77e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) -## [0.35.5] - 2023-10-05 +## [0.35.5] - 2023-10-06 + +### Changes + +- Setting `autocomplete` in passwordless forms for email, phone and OTP ### Fixes diff --git a/lib/build/passwordless-shared3.js b/lib/build/passwordless-shared3.js index de28acb50..54b23e5a7 100644 --- a/lib/build/passwordless-shared3.js +++ b/lib/build/passwordless-shared3.js @@ -579,6 +579,7 @@ var EmailForm = uiEntry.withOverride("PasswordlessEmailForm", function Passwordl optional: false, autofocus: true, placeholder: "", + autoComplete: "email", // We are using the default validator that allows any string validate: validators.defaultValidate, }, @@ -2774,6 +2775,9 @@ var EmailOrPhoneForm = uiEntry.withOverride( optional: false, autofocus: true, placeholder: "", + // We do not add an autocomplete prop in this case, since we do not really have any sensible option to set + // Setting them to either "tel" or "email" would give people the wrong impression since this could have either + // AFAIK we can't set them both at the same time validate: recipe$1.defaultValidate, }, ], @@ -3415,6 +3419,7 @@ var PhoneForm = uiEntry.withOverride("PasswordlessPhoneForm", function Passwordl optional: false, autofocus: true, placeholder: "", + autoComplete: "tel", validate: validators.defaultValidate, }, ], @@ -3636,6 +3641,7 @@ var UserInputCodeForm = uiEntry.withOverride( autofocus: true, optional: false, clearOnSubmit: true, + autoComplete: "one-time-code", placeholder: "", validate: recipe$1.userInputCodeValidate, }, diff --git a/lib/ts/recipe/passwordless/components/themes/signInUp/emailForm.tsx b/lib/ts/recipe/passwordless/components/themes/signInUp/emailForm.tsx index 451b60535..97159f306 100644 --- a/lib/ts/recipe/passwordless/components/themes/signInUp/emailForm.tsx +++ b/lib/ts/recipe/passwordless/components/themes/signInUp/emailForm.tsx @@ -40,6 +40,7 @@ export const EmailForm = withOverride( optional: false, autofocus: true, placeholder: "", + autoComplete: "email", // We are using the default validator that allows any string validate: defaultValidate, }, diff --git a/lib/ts/recipe/passwordless/components/themes/signInUp/emailOrPhoneForm.tsx b/lib/ts/recipe/passwordless/components/themes/signInUp/emailOrPhoneForm.tsx index 8e7bd9cb6..54d2f0295 100644 --- a/lib/ts/recipe/passwordless/components/themes/signInUp/emailOrPhoneForm.tsx +++ b/lib/ts/recipe/passwordless/components/themes/signInUp/emailOrPhoneForm.tsx @@ -59,6 +59,9 @@ export const EmailOrPhoneForm = withOverride( optional: false, autofocus: true, placeholder: "", + // We do not add an autocomplete prop in this case, since we do not really have any sensible option to set + // Setting them to either "tel" or "email" would give people the wrong impression since this could have either + // AFAIK we can't set them both at the same time validate: defaultValidate, }, ]} diff --git a/lib/ts/recipe/passwordless/components/themes/signInUp/phoneForm.tsx b/lib/ts/recipe/passwordless/components/themes/signInUp/phoneForm.tsx index f081908da..fb2b8805f 100644 --- a/lib/ts/recipe/passwordless/components/themes/signInUp/phoneForm.tsx +++ b/lib/ts/recipe/passwordless/components/themes/signInUp/phoneForm.tsx @@ -56,6 +56,7 @@ export const PhoneForm = withOverride( optional: false, autofocus: true, placeholder: "", + autoComplete: "tel", validate: defaultValidate, }, ]} diff --git a/lib/ts/recipe/passwordless/components/themes/signInUp/userInputCodeForm.tsx b/lib/ts/recipe/passwordless/components/themes/signInUp/userInputCodeForm.tsx index 7ce45d203..d237ed0e6 100644 --- a/lib/ts/recipe/passwordless/components/themes/signInUp/userInputCodeForm.tsx +++ b/lib/ts/recipe/passwordless/components/themes/signInUp/userInputCodeForm.tsx @@ -121,6 +121,7 @@ export const UserInputCodeForm = withOverride( autofocus: true, optional: false, clearOnSubmit: true, + autoComplete: "one-time-code", placeholder: "", validate: userInputCodeValidate, },