Skip to content

Commit

Permalink
Fix missing CSRF tokens for profile page (#1946)
Browse files Browse the repository at this point in the history
#1640 fixed a slew of issues with the profile page, and completely
overhauled the underlying code. This PR is a minimal patch to restore
password-change functionality for CDash 3.2.
  • Loading branch information
williamjallen authored Jan 11, 2024
1 parent 9023936 commit a150470
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ public function edit(): View
$xml .= '<error>Your password has expired. Please set a new one.</error>';
}

$xml .= '<csrf>' . csrf_token() . '</csrf>';
$xml .= '</cdash>';

return view('cdash', [
Expand Down
2 changes: 2 additions & 0 deletions app/cdash/public/editUser.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<td colspan="5" id="nob"><h3>My Profile</h3></td>
</tr>
<form method="post" action="" name="updatprofile_form">
<input type="hidden" name="_token"><xsl:attribute name="value"><xsl:value-of select="cdash/csrf"/></xsl:attribute></input>
<tr class="treven">
<td width="20%" height="2"><div align="right">First Name</div></td>
<td width="80%" height="2" id="nob"><input class="textbox" name="fname" size="20">
Expand Down Expand Up @@ -50,6 +51,7 @@
</tr>
</form>
<form method="post" action="" name="updatemail_form">
<input type="hidden" name="_token"><xsl:attribute name="value"><xsl:value-of select="cdash/csrf"/></xsl:attribute></input>
<tr class="trodd">
<td width="20%" height="2" ><div align="right">Current Password</div></td>
<td width="80%" height="2" id="nob"><input class="textbox" type="password" name="oldpasswd" size="20"/></td>
Expand Down

0 comments on commit a150470

Please sign in to comment.