Skip to content

Commit 3cfda69

Browse files
committed
Updates
1 parent e36f2db commit 3cfda69

File tree

2 files changed

+13
-26
lines changed

2 files changed

+13
-26
lines changed

packages/template-retail-react-app/app/components/otp-auth/index.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ const OtpAuth = ({
8686

8787
useEffect(() => {
8888
if (isOpen) {
89-
otpInputs.clear()
9089
setError('')
9190
form.setValue('otp', '')
9291

packages/template-retail-react-app/app/hooks/use-auth-modal.js

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,10 @@ export const AuthModal = ({
110110
const handlePasswordlessLogin = async (email) => {
111111
try {
112112
const redirectPath = window.location.pathname + (window.location.search || '')
113-
const params = {
113+
await authorizePasswordlessLogin.mutateAsync({
114114
userid: email,
115-
mode: passwordlessMode
116-
}
117-
118-
// Only include callbackURI if mode is 'callback'
119-
if (passwordlessMode === 'callback') {
120-
params.callbackURI = `${callbackURL}?redirectUrl=${redirectPath}`
121-
}
122-
123-
await authorizePasswordlessLogin.mutateAsync(params)
115+
callbackURI: `${callbackURL}?redirectUrl=${redirectPath}`
116+
})
124117
setCurrentView(EMAIL_VIEW)
125118
} catch (error) {
126119
const message = PASSWORDLESS_ERROR_MESSAGES.some((msg) => msg.test(error.message))
@@ -130,7 +123,6 @@ export const AuthModal = ({
130123
}
131124
}
132125

133-
134126
const submitForm = async (data, isPasswordless = false) => {
135127
form.clearErrors()
136128

@@ -275,9 +267,7 @@ export const AuthModal = ({
275267
onClose()
276268

277269
if (config?.app?.login?.passkey?.enabled) {
278-
// Show passkey registration modal if:
279-
// 1. Webauthn feature flag is enabled
280-
// 2. Compatible with the browser
270+
// Show passkey registration modal only if Webauthn feature flag is enabled and compatible with the browser
281271
if (
282272
window.PublicKeyCredential &&
283273
PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable &&
@@ -331,16 +321,15 @@ export const AuthModal = ({
331321
initialView === PASSWORD_VIEW ? onClose() : setCurrentView(LOGIN_VIEW)
332322

333323
return (
334-
<>
335-
<Modal
336-
size="sm"
337-
closeOnOverlayClick={false}
338-
data-testid="sf-auth-modal"
339-
isOpen={isOpen}
340-
onOpen={onOpen}
341-
onClose={onClose}
342-
{...props}
343-
>
324+
<Modal
325+
size="sm"
326+
closeOnOverlayClick={false}
327+
data-testid="sf-auth-modal"
328+
isOpen={isOpen}
329+
onOpen={onOpen}
330+
onClose={onClose}
331+
{...props}
332+
>
344333
<ModalOverlay />
345334
<ModalContent>
346335
<ModalCloseButton
@@ -393,7 +382,6 @@ export const AuthModal = ({
393382
</ModalBody>
394383
</ModalContent>
395384
</Modal>
396-
</>
397385
)
398386
}
399387

0 commit comments

Comments
 (0)