File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 44
55use UnityWebPortal \lib \UnityHTTPD ;
66use UnityWebPortal \lib \UserFlag ;
7+ use UnityWebPortal \lib \CSRFToken ;
78
89if (!$ USER ->getFlag (UserFlag::ADMIN )) {
910 UnityHTTPD::forbidden ("not an admin " , "You are not an admin. " );
@@ -54,6 +55,7 @@ class="filterSearch"
5455 "mail " => ["(not found) " ]
5556 ]
5657 );
58+ $ csrf_token = htmlspecialchars (CSRFToken::generate ());
5759 usort ($ user_attributes , fn ($ a , $ b ) => strcmp ($ a ["uid " ][0 ], $ b ["uid " ][0 ]));
5860 foreach ($ user_attributes as $ attributes ) {
5961 $ uid = $ attributes ["uid " ][0 ];
@@ -80,10 +82,9 @@ class="filterSearch"
8082 }
8183 echo "</td> " ;
8284 echo "<td> " ;
83- $ CSRFTokenHiddenFormInput = UnityHTTPD::getCSRFTokenHiddenFormInput ();
8485 echo "<form class='viewAsUserForm' action='' method='POST'
8586 onsubmit='return confirm( \"Are you sure you want to switch to the user $ uid? \");'>
86- $ CSRFTokenHiddenFormInput
87+ <input type='hidden' name='csrf_token' value=' $ csrf_token '>
8788 <input type='hidden' name='form_type' value='viewAsUser'>
8889 <input type='hidden' name='uid' value=' $ uid'>
8990 <input type='submit' name='action' value='Access'>
You can’t perform that action at this time.
0 commit comments