Skip to content

Commit

Permalink
Merge branch 'master' into buid/5.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DawoudIO authored Feb 3, 2025
2 parents 441b438 + 27372c7 commit f6b82f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/ChurchCRM/utils/InputUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public static function filterString($sInput): string
return strip_tags(trim($sInput));
}

public static function filterSanitizeString($sInput): string
{
return filter_var(trim($sInput), FILTER_SANITIZE_SPECIAL_CHARS);
}

public static function filterHTML($sInput): string
{
return strip_tags(trim($sInput), self::$AllowedHTMLTags);
Expand Down
5 changes: 3 additions & 2 deletions src/session/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use ChurchCRM\Authentication\Requests\LocalUsernamePasswordRequest;
use ChurchCRM\dto\SystemURLs;
use ChurchCRM\Slim\Middleware\VersionMiddleware;
use ChurchCRM\Utils\InputUtils;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
Expand Down Expand Up @@ -80,8 +81,8 @@ function beginSession(Request $request, Response $response, array $args): Respon
$renderer = new PhpRenderer('templates/');

// Determine if appropriate to pre-fill the username field
$pageArgs['prefilledUserName'] = $request->getQueryParams()['username'] ??
$request->getServerParams()['username'] ??
$pageArgs['prefilledUserName'] = InputUtils::filterSanitizeString($request->getQueryParams()['username']) ??
InputUtils::filterSanitizeString($request->getServerParams()['username']) ??
'';

return $renderer->render($response, 'begin-session.php', $pageArgs);
Expand Down

0 comments on commit f6b82f6

Please sign in to comment.