Do all loading before request validation

This commit is contained in:
Giuseppe Criscione 2021-01-04 14:04:00 +01:00
parent 6d279534bb
commit a4514c97ba

View File

@ -99,11 +99,6 @@ final class Admin
*/
public function run(): void
{
if (HTTPRequest::method() === 'POST') {
$this->validateContentLength();
$this->validateCSRFToken();
}
$this->loadSchemes();
$this->users = Users::load();
@ -113,6 +108,11 @@ final class Admin
$this->loadRoutes();
if (HTTPRequest::method() === 'POST') {
$this->validateContentLength();
$this->validateCSRFToken();
}
if ($this->users->isEmpty()) {
$this->registerAdmin();
}