Fixes #2147 Add style elements to generated page

Updated generated html code so it fits the design
Added warning triangle icon as svg

Page now hides the login button in case user is already logged in
This commit is contained in:
marsooooo
2024-04-12 15:48:47 +02:00
parent 16953317d9
commit 562fb6c0be
2 changed files with 21 additions and 6 deletions
+18 -6
View File
@@ -255,7 +255,7 @@ function tag_alpha_compare($a, $b)
}
/**
* Exits the current script (or redirect to login page if not logged).
* Exits the current script.
*/
function access_denied()
{
@@ -265,14 +265,19 @@ function access_denied()
get_root_url().'identification.php?redirect='
.urlencode(urlencode($_SERVER['REQUEST_URI']));
$access_denied_html =
'<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'.
'<div style="display: flex; justify-content: center;align-items: center;height: 100vh;margin: 0;color: #3C3C3C;font-family: \'Open Sans\';font-size: 20px;font-style: normal;font-weight: 600;line-height: normal;">'.
'<div style="text-align:center;">'.
'<img src="themes/default/icon/warning-triangle.svg" alt="warning-triangle" >'.
'<p style="max-width: 400px; margin-top 20px;">'.l10n('You are not authorized to access the requested page').'</p>';
if ( isset($user) and !is_a_guest() )
{
set_status_header(401);
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
echo '<div style="text-align:center;">'.l10n('You are not authorized to access the requested page').'<br>';
echo '<a href="'.get_root_url().'identification.php">'.l10n('Identification').'</a>&nbsp;';
echo '<a href="'.make_index_url().'">'.l10n('Home').'</a></div>';
echo $access_denied_html;
echo '<a href="'.make_index_url().'" style="display: inline-block;padding: 10px 20px;margin: 10px;margin-top: 50px;border-radius: 7px;cursor: pointer;width: 150px;background-color: #F77000;color: #fff;text-decoration: none;border: 2px solid #F77000;">'.l10n('Home').'</a></div></div>';
echo str_repeat( ' ', 512); //IE6 doesn't error output if below a size
exit();
}
@@ -282,10 +287,17 @@ function access_denied()
}
else
{
redirect_html($login_url);
set_status_header(401);
echo $access_denied_html;
echo '<a href="'.get_root_url().'identification.php" style="display: inline-block;padding: 10px 20px;margin: 10px;margin-top: 50px;border-radius: 7px;cursor: pointer;width: 150px;background-color: #F77000;color: #fff;text-decoration: none;border: 2px solid #F77000;">'.l10n('Identification').'</a>';
echo '<a href="'.make_index_url().'" style="display: inline-block;padding: 10px 20px;margin: 10px;margin-top: 50px;border-radius: 7px;cursor: pointer;width: 150px;color: #F77000;text-decoration: none;border: 2px solid #F77000;">'.l10n('Home').'</a></div></div>';
echo str_repeat( ' ', 512); //IE6 doesn't error output if below a size
exit();
}
}
/**
* Exits the current script with 403 code.
* @todo nice display if $template loaded
+3
View File
@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" fill="#F77000" class="bi bi-exclamation-triangle-fill" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5m.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2"/>
</svg>

After

Width:  |  Height:  |  Size: 392 B