Skip to content

Commit 436a564

Browse files
committed
refactor
1 parent 242a934 commit 436a564

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

resources/lib/CSRFToken.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@ public static function validate(string $token): bool
5454
return true;
5555
}
5656

57-
public static function getHiddenInput(): string
58-
{
59-
$token = htmlspecialchars(self::generate());
60-
return "<input type='hidden' name='csrf_token' value='$token'>";
61-
}
62-
6357
public static function clear(): void
6458
{
6559
if (!isset($_SESSION)) {

resources/lib/UnityHTTPD.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,17 @@ public static function clearMessages()
328328
$_SESSION["messages"] = [];
329329
}
330330

331-
public static function validateCSRFToken(): void
331+
public static function validatePostCSRFToken(): void
332332
{
333333
$token = self::getPostData("csrf_token");
334334
if (!CSRFToken::validate($token)) {
335335
self::badRequest("CSRF token validation failed", data: ["token" => $token]);
336336
}
337337
}
338+
339+
public static function getCSRFTokenHiddenFormInput(): string
340+
{
341+
$token = htmlspecialchars(CSRFToken::generate());
342+
return "<input type='hidden' name='csrf_token' value='$token'>";
343+
}
338344
}

0 commit comments

Comments
 (0)