Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: obfuscate short emails

ammarahm-ed3621f95dbc85
diff --git a/apps/web/src/views/auth.tsx b/apps/web/src/views/auth.tsx
index 9a3a83d2b..7e2467d96 100644
--- a/apps/web/src/views/auth.tsx
+++ b/apps/web/src/views/auth.tsx
@@ -1019,13 +1019,14 @@ function openURL(url: string, force?: boolean) {
function maskEmail(email: string) {
if (!email) return "";
- const [username, domain] = email.split("@");
- const maskChars = "*".repeat(
- username.substring(2, username.length - 2).length
- );
- return `${username.substring(0, 2)}${maskChars}${username.substring(
- username.length - 2
- )}@${domain}`;
+ const [username, provider] = email.split("@");
+ if (username.length === 1) return `****@${provider}`;
+ return email.replace(/(.{1})(.*)(?=@)/, function (gp1, gp2, gp3) {
+ for (let i = 0; i < gp3.length; i++) {
+ gp2 += "*";
+ }
+ return gp2;
+ });
}
function isSessionExpired() {