File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import * as Icon from '~/primitives/icon';
2424import { LinkButton } from '~/primitives/link-button' ;
2525import { SecondaryButton } from '~/primitives/secondary-button' ;
2626import { Seperator } from '~/primitives/seperator' ;
27+ import { formatSafeIdentifier } from '~/utils/format-safe-identifier' ;
2728
2829export function SignInComponent ( ) {
2930 return (
@@ -204,7 +205,11 @@ export function SignInComponentLoaded() {
204205 < Card . Description > { t ( 'signIn.password.subtitle' ) } </ Card . Description >
205206 < Card . Description >
206207 < span className = 'flex items-center justify-center gap-2' >
207- < SignIn . SafeIdentifier />
208+ < SignIn . SafeIdentifier
209+ transform = { val => {
210+ return formatSafeIdentifier ( val ) || val ;
211+ } }
212+ />
208213 < SignIn . Action
209214 navigate = 'start'
210215 asChild
Original file line number Diff line number Diff line change 1+ import { stringToFormattedPhoneString } from '~/common/phone-number-field/utils' ;
2+
3+ export const isMaskedIdentifier = ( str : string | undefined | null ) => str && str . includes ( '**' ) ;
4+
5+ /**
6+ * Formats a string that can contain an email, a username or a phone number.
7+ * Depending on the scenario, the string might be obfuscated (parts of the identifier replaced with "*")
8+ * Refer to the tests for examples.
9+ */
10+ export const formatSafeIdentifier = ( str : string | undefined | null ) => {
11+ if ( ! str || str . includes ( '@' ) || isMaskedIdentifier ( str ) || str . match ( / [ a - z A - Z ] / ) ) {
12+ return str ;
13+ }
14+ return stringToFormattedPhoneString ( str ) ;
15+ } ;
You can’t perform that action at this time.
0 commit comments