Skip to content

Commit a799206

Browse files
fix(auth): correct email and phone verification alert messages
Use field-specific success copy after verify/unverify actions so phone updates no longer show inverted account-level status text. Fixes #1392
1 parent ee7514c commit a799206

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

src/routes/(console)/project-[region]-[project]/auth/user-[user]/updateStatus.svelte

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@
1515
1616
let showVerificationDropdown = false;
1717
18+
function getVerificationMessage(
19+
type: 'email' | 'phone',
20+
name: string | undefined,
21+
verified: boolean
22+
): string {
23+
const status = verified ? 'has been verified' : 'is no longer verified';
24+
25+
if (name?.trim()) {
26+
return `The ${type} for ${name.trim()} ${status}`;
27+
}
28+
29+
return `The ${type} ${status}`;
30+
}
31+
1832
async function updateVerificationEmail() {
1933
showVerificationDropdown = false;
2034
try {
@@ -26,9 +40,7 @@
2640
});
2741
await invalidate(Dependencies.USER);
2842
addNotification({
29-
message: `${$user.name || $user.email || $user.phone || 'The account'} has been ${
30-
!$user.emailVerification ? 'unverified' : 'verified'
31-
}`,
43+
message: getVerificationMessage('email', $user.name, $user.emailVerification),
3244
type: 'success'
3345
});
3446
trackEvent(Submit.UserUpdateVerificationEmail);
@@ -51,9 +63,7 @@
5163
});
5264
await invalidate(Dependencies.USER);
5365
addNotification({
54-
message: `${$user.name || $user.email || $user.phone || 'The account'} has been ${
55-
$user.phoneVerification ? 'unverified' : 'verified'
56-
}`,
66+
message: getVerificationMessage('phone', $user.name, $user.phoneVerification),
5767
type: 'success'
5868
});
5969
trackEvent(Submit.UserUpdateVerificationPhone);

0 commit comments

Comments
 (0)