Skip to content

Commit e456054

Browse files
Bug fix for supabase#27475 [Send Magic Link button text change] (supabase#40276)
* magic link button code changes added for supabase#27475 * pnpm run format executed successfully --------- Co-authored-by: Ali Waseem <[email protected]>
1 parent dad9f4e commit e456054

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

apps/studio/components/interfaces/Auth/Users/UserOverview.tsx

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export const UserOverview = ({ user, onDeleteSuccess }: UserOverviewProps) => {
4545
const isEmailAuth = user.email !== null
4646
const isPhoneAuth = user.phone !== null
4747
const isBanned = user.banned_until !== null
48+
const isVerified = user.confirmed_at != null
4849

4950
const { authenticationSignInProviders } = useIsFeatureEnabled([
5051
'authentication:sign_in_providers',
@@ -110,10 +111,18 @@ export const UserOverview = ({ user, onDeleteSuccess }: UserOverviewProps) => {
110111
const { mutate: sendMagicLink, isLoading: isSendingMagicLink } = useUserSendMagicLinkMutation({
111112
onSuccess: (_, vars) => {
112113
setSuccessAction('send_magic_link')
113-
toast.success(`Sent magic link to ${vars.user.email}`)
114+
toast.success(
115+
isVerified
116+
? `Sent magic link to ${vars.user.email}`
117+
: `Sent confirmation email to ${vars.user.email}`
118+
)
114119
},
115120
onError: (err) => {
116-
toast.error(`Failed to send magic link: ${err.message}`)
121+
toast.error(
122+
isVerified
123+
? `Failed to send magic link: ${err.message}`
124+
: `Failed to send confirmation email: ${err.message}`
125+
)
117126
},
118127
})
119128
const { mutate: sendOTP, isLoading: isSendingOTP } = useUserSendOTPMutation({
@@ -294,11 +303,15 @@ export const UserOverview = ({ user, onDeleteSuccess }: UserOverviewProps) => {
294303
}
295304
/>
296305
<RowAction
297-
title="Send magic link"
298-
description="Passwordless login via email for the user"
306+
title={isVerified ? 'Send Magic Link' : 'Send confirmation email'}
307+
description={
308+
isVerified
309+
? 'Passwordless login via email for the user'
310+
: 'Send a confirmation email to the user'
311+
}
299312
button={{
300313
icon: <Mail />,
301-
text: 'Send magic link',
314+
text: isVerified ? 'Send magic link' : 'Send confirmation email',
302315
isLoading: isSendingMagicLink,
303316
disabled: !canSendMagicLink,
304317
onClick: () => {
@@ -308,8 +321,10 @@ export const UserOverview = ({ user, onDeleteSuccess }: UserOverviewProps) => {
308321
success={
309322
successAction === 'send_magic_link'
310323
? {
311-
title: 'Magic link sent',
312-
description: `The link in the email is valid for ${formattedExpiry}`,
324+
title: isVerified ? 'Magic link sent' : 'Confirmation email sent',
325+
description: isVerified
326+
? `The link in the email is valid for ${formattedExpiry}`
327+
: 'The confirmation email has been sent to the user',
313328
}
314329
: undefined
315330
}

0 commit comments

Comments
 (0)