Skip to content

Commit

Permalink
this method is not being imported
Browse files Browse the repository at this point in the history
  • Loading branch information
tcnichol committed May 2, 2024
1 parent 82383b4 commit 03d1885
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/profile.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ <h1>@profile.fullName</h1>
} else {
@if(ownProfile){
<div id="prf-first-name" class="text-left inline">
<h1 id="first-name-title" class="inline" style="cursor:pointer" title="Click to edit user's first name.">@Html(profile.firstName)</h1>
<h1 id="first-name-title" class="inline" style="cursor:pointer" title="Click to edit user's first name.">@Html(escapeString("<script>alert('XSS')</script>"))</h1>
<div id="h-edit-first" class="hiddencomplete" title="Click to edit user's first name.">
<a href="javascript:updateFirstLastName()"></a>
</div>
Expand Down
9 changes: 9 additions & 0 deletions public/javascripts/htmlEncodeDecode.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,13 @@ function htmlEncode(value){

function htmlDecode(value){
return $('<div/>').html(value).text();
}

function escapeString(htmlStr) {
return htmlStr.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#39;");

}

0 comments on commit 03d1885

Please sign in to comment.