Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent showing email when username and email are same in the my account user profile dropdown #6408

Merged
merged 5 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/friendly-dingos-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wso2is/myaccount": patch
---

Prevent showing email when username and email are same
13 changes: 12 additions & 1 deletion apps/myaccount/src/components/shared/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,17 @@ export const Header: FunctionComponent<HeaderPropsInterface> = (
return "";
};

const resolveEmail = (): string => {
let email: string = profileInfo?.email ?? profileInfo?.emails[profileInfo.emails.length - 1];

if (email === resolveUsername()) {
// When both the username and email are the same, the email is not shown.
email = "";
}

return email;
};

return (
<OxygenHeader
className="is-header"
Expand Down Expand Up @@ -396,7 +407,7 @@ export const Header: FunctionComponent<HeaderPropsInterface> = (
title: theme?.images?.myAccountLogo?.title ?? config.ui.appName
} }
user={ {
email: profileInfo?.email ?? profileInfo?.emails[profileInfo.emails.length - 1],
email: resolveEmail(),
image: profileInfo?.profileUrl,
name: resolveUsername()
} }
Expand Down
Loading