diff --git a/.env.example b/.env.example index 5ab022c..6d071d0 100644 --- a/.env.example +++ b/.env.example @@ -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 diff --git a/400.php b/400.php new file mode 100644 index 0000000..e9fbd9b --- /dev/null +++ b/400.php @@ -0,0 +1,55 @@ +getDeniedCode()} {$env->getDeniedTitle()}", true, $env->getDeniedCode()); +?> + + +
+ +getDeniedMessage(); ?>
+ + diff --git a/src/Env.php b/src/Env.php index ccd513c..35c14b4 100644 --- a/src/Env.php +++ b/src/Env.php @@ -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.'; + } }