Skip to content

Commit

Permalink
Merge pull request #7069 from topcoder-platform/pm-714
Browse files Browse the repository at this point in the history
fix(PM-714): encode uri return url to fix xss dom error
  • Loading branch information
hentrymartin authored Feb 18, 2025
2 parents 5c9ca46 + 6e7d2a0 commit 578141f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/shared/containers/tc-communities/tco20/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ function TCO20Header(props) {
</React.Fragment>
) : (
<React.Fragment>
<a href={`${config.URL.AUTH}/member?utm_source=TCO20site&retUrl=${getCurrentUrl()}`} className={defaultStyle.loginLink}>LOGIN</a>
<a href={`${config.URL.AUTH}/member/registration?utm_source=TCO20site&retUrl=${getCurrentUrl()}`} className={defaultStyle.signUpLink}>SIGN UP</a>
<a href={`${config.URL.AUTH}/member?utm_source=TCO20site&retUrl=${encodeURIComponent(getCurrentUrl())}`} className={defaultStyle.loginLink}>LOGIN</a>
<a href={`${config.URL.AUTH}/member/registration?utm_source=TCO20site&retUrl=${encodeURIComponent(getCurrentUrl())}`} className={defaultStyle.signUpLink}>SIGN UP</a>
</React.Fragment>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { BUCKETS } from 'utils/challenge-listing/buckets';
*/
export function getCurrentUrl() {
if (isomorphy.isServerSide()) return null;
const url = window.location.href;
const url = window.location.origin + window.location.pathname;

if (typeof url === 'string' && url.startsWith('http')) {
return url;
Expand Down

0 comments on commit 578141f

Please sign in to comment.