Skip to content

Commit

Permalink
Merge pull request #1148 from warcooft/patch-escape-string
Browse files Browse the repository at this point in the history
fix: escape string to prevent XSS attack
  • Loading branch information
datamweb authored Jul 22, 2024
2 parents a38b3cc + 9e283d3 commit 81a0bef
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Views/email_2fa_show.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<p><?= lang('Auth.confirmEmailAddress') ?></p>

<?php if (session('error')) : ?>
<div class="alert alert-danger"><?= session('error') ?></div>
<div class="alert alert-danger"><?= esc(session('error')) ?></div>
<?php endif ?>

<form action="<?= url_to('auth-action-handle') ?>" method="post">
Expand Down
2 changes: 1 addition & 1 deletion src/Views/email_2fa_verify.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<p><?= lang('Auth.emailConfirmCode') ?></p>

<?php if (session('error') !== null) : ?>
<div class="alert alert-danger"><?= session('error') ?></div>
<div class="alert alert-danger"><?= esc(session('error')) ?></div>
<?php endif ?>

<form action="<?= url_to('auth-action-verify') ?>" method="post">
Expand Down
2 changes: 1 addition & 1 deletion src/Views/email_activate_show.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<h5 class="card-title mb-5"><?= lang('Auth.emailActivateTitle') ?></h5>

<?php if (session('error')) : ?>
<div class="alert alert-danger"><?= session('error') ?></div>
<div class="alert alert-danger"><?= esc(session('error')) ?></div>
<?php endif ?>

<p><?= lang('Auth.emailActivateBody') ?></p>
Expand Down
8 changes: 4 additions & 4 deletions src/Views/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
<h5 class="card-title mb-5"><?= lang('Auth.login') ?></h5>

<?php if (session('error') !== null) : ?>
<div class="alert alert-danger" role="alert"><?= session('error') ?></div>
<div class="alert alert-danger" role="alert"><?= esc(session('error')) ?></div>
<?php elseif (session('errors') !== null) : ?>
<div class="alert alert-danger" role="alert">
<?php if (is_array(session('errors'))) : ?>
<?php foreach (session('errors') as $error) : ?>
<?= $error ?>
<?= esc($error) ?>
<br>
<?php endforeach ?>
<?php else : ?>
<?= session('errors') ?>
<?= esc(session('errors')) ?>
<?php endif ?>
</div>
<?php endif ?>

<?php if (session('message') !== null) : ?>
<div class="alert alert-success" role="alert"><?= session('message') ?></div>
<div class="alert alert-success" role="alert"><?= esc(session('message')) ?></div>
<?php endif ?>

<form action="<?= url_to('login') ?>" method="post">
Expand Down
6 changes: 3 additions & 3 deletions src/Views/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
<h5 class="card-title mb-5"><?= lang('Auth.register') ?></h5>

<?php if (session('error') !== null) : ?>
<div class="alert alert-danger" role="alert"><?= session('error') ?></div>
<div class="alert alert-danger" role="alert"><?= esc(session('error')) ?></div>
<?php elseif (session('errors') !== null) : ?>
<div class="alert alert-danger" role="alert">
<?php if (is_array(session('errors'))) : ?>
<?php foreach (session('errors') as $error) : ?>
<?= $error ?>
<?= esc($error) ?>
<br>
<?php endforeach ?>
<?php else : ?>
<?= session('errors') ?>
<?= esc(session('errors')) ?>
<?php endif ?>
</div>
<?php endif ?>
Expand Down

0 comments on commit 81a0bef

Please sign in to comment.