Skip to content

Commit

Permalink
mobile: obfuscate short emails
Browse files Browse the repository at this point in the history
  • Loading branch information
ammarahm-ed authored and thecodrr committed Apr 26, 2023
1 parent 3621f95 commit f9bcfe2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/mobile/app/components/auth/session-expired.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ import Paragraph from "../ui/typography/paragraph";
import { LoginSteps, useLogin } from "./use-login";

function getObfuscatedEmail(email) {
if (!email) return null;
return email.replace(/(.{2})(.*)(?=@)/, function (gp1, gp2, gp3) {
if (!email) return "";
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 += "*";
}
Expand Down

0 comments on commit f9bcfe2

Please sign in to comment.