new page for client error (too many requests).. work in progress
This commit is contained in:
@@ -15,6 +15,9 @@ PREAUTH_TITLE='Pre-Authentication System'
|
||||
PREAUTH_ID_NAME='Session ID'
|
||||
PREAUTH_TOKEN_NAME='Authentication Token'
|
||||
PREAUTH_SUBMIT_NAME='Submit'
|
||||
PREAUTH_DENIED_CODE='418'
|
||||
PREAUTH_DENIED_TITLE="I'm a teapot"
|
||||
PREAUTH_DENIED_MESSAGE='I refuse to brew coffee.'
|
||||
|
||||
# who owns the session files
|
||||
# permissions of the volume must match
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
use Preauth\Env;
|
||||
global $auth;
|
||||
$env = new Env();
|
||||
header("http/1.1 {$env->getDeniedCode()} {$env->getDeniedTitle()}", true, $env->getDeniedCode());
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title><?php echo $env->getTitle(); ?></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!-- Begin Icons -->
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="https://<?php echo $auth->getBaseDomain(); ?>/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="https://<?php echo $auth->getBaseDomain(); ?>/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="https://<?php echo $auth->getBaseDomain(); ?>/android-chrome-192x192.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="https://<?php echo $auth->getBaseDomain(); ?>/favicon-16x16.png">
|
||||
<link rel="manifest" href="https://<?php echo $auth->getBaseDomain(); ?>/site.webmanifest">
|
||||
<meta name="apple-mobile-web-app-title" content="<?php echo $env->getTitle(); ?>">
|
||||
<meta name="application-name" content="<?php echo $env->getTitle(); ?>">
|
||||
<meta name="msapplication-TileColor" content="<?php echo $env->getColor(); ?>">
|
||||
<meta name="theme-color" content="<?php echo $env->getColor(); ?>">
|
||||
<!-- End Icons -->
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0.25em;
|
||||
}
|
||||
html {
|
||||
background-color: <?php echo $env->getColor(); ?>;
|
||||
color: <?php echo $env->getTextColor(); ?>;
|
||||
display: table;
|
||||
font-family: sans-serif;
|
||||
font-size: 1.5em;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
body {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
h1 {
|
||||
font-size: 2.5em;
|
||||
font-weight: normal;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1><?php echo $env->getTitle(); ?></h1>
|
||||
<h2><?php echo $env->getDeniedTitle(); ?></h2>
|
||||
<p><?php echo $env->getDeniedMessage(); ?></p>
|
||||
</body>
|
||||
</html>
|
||||
+31
-4
@@ -8,21 +8,24 @@ class Env {
|
||||
* @return string returns title of this system
|
||||
*/
|
||||
public function getTitle(): string {
|
||||
return getenv('PREAUTH_TITLE') ?: 'Pre-Authentication System';
|
||||
return getenv('PREAUTH_TITLE')
|
||||
?: 'Pre-Authentication System';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string returns background-color of this system
|
||||
*/
|
||||
public function getColor(): string {
|
||||
return getenv('PREAUTH_BACKGROUND') ?: '#029386'; // teal
|
||||
// defaults to teal
|
||||
return getenv('PREAUTH_BACKGROUND') ?: '#029386';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string returns text-color of this system
|
||||
*/
|
||||
public function getTextColor(): string {
|
||||
return getenv('PREAUTH_FOREGROUND') ?: '#ffffff'; // white
|
||||
// defaults to white
|
||||
return getenv('PREAUTH_FOREGROUND') ?: '#ffffff';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,7 +39,8 @@ class Env {
|
||||
* @return string returns the name of the Token field
|
||||
*/
|
||||
public function getTokenName(): string {
|
||||
return getenv('PREAUTH_TOKEN_NAME') ?: 'Authentication Token';
|
||||
return getenv('PREAUTH_TOKEN_NAME')
|
||||
?: 'Authentication Token';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,5 +49,28 @@ class Env {
|
||||
public function getSubmitName(): string {
|
||||
return getenv('PREAUTH_SUBMIT_NAME') ?: 'Submit';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string returns the denied http status code
|
||||
*/
|
||||
public function getDeniedCode(): string {
|
||||
return getenv('PREAUTH_DENIED_CODE') ?: '418';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string returns the denied response title
|
||||
*/
|
||||
public function getDeniedTitle(): string {
|
||||
return getenv('PREAUTH_DENIED_TITLE')
|
||||
?: "I'm a teapot";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string returns the denied response message
|
||||
*/
|
||||
public function getDeniedMessage(): string {
|
||||
return getenv('PREAUTH_DENIED_MESSAGE')
|
||||
?: 'I refuse to brew coffee.';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user