-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAuthFallbackOptions.tsx
More file actions
67 lines (57 loc) · 1.9 KB
/
AuthFallbackOptions.tsx
File metadata and controls
67 lines (57 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* Copyright © 2026 Fells Code, LLC
* Licensed under the GNU Affero General Public License v3.0
* See LICENSE file in the project root for full license information
*/
import React from 'react';
import { isValidEmail, isValidPhoneNumber } from '../utils';
import styles from '../styles/login.module.css';
interface AuthFallbackOptionsProps {
identifier: string;
onMagicLink: () => void;
onPhoneOtp: () => void;
onPasskeyRetry: () => void;
}
const AuthFallbackOptions: React.FC<AuthFallbackOptionsProps> = ({
identifier,
onMagicLink,
onPhoneOtp,
onPasskeyRetry,
}) => {
const showMagicLink = isValidEmail(identifier);
const showPhoneOtp = isValidPhoneNumber(identifier);
return (
<div className={styles.fallbackCard}>
<div className={styles.fallbackHeader}>Passkeys unavailable on this device</div>
<p className={styles.fallbackDescription}>Choose another secure sign-in method.</p>
<div className={styles.fallbackActions}>
{showMagicLink && (
<button
type="button"
className={styles.fallbackActionButton}
onClick={onMagicLink}
>
<span className={styles.actionTitle}>Email Magic Link</span>
<span className={styles.actionSubtext}>
Send a secure sign-in link to your email
</span>
</button>
)}
{showPhoneOtp && (
<button
type="button"
className={styles.fallbackActionButton}
onClick={onPhoneOtp}
>
<span className={styles.actionTitle}>Text Message Code</span>
<span className={styles.actionSubtext}>Receive a one-time code via SMS</span>
</button>
)}
</div>
<button type="button" className={styles.linkButton} onClick={onPasskeyRetry}>
Try passkey anyway
</button>
</div>
);
};
export default AuthFallbackOptions;