diff --git a/assets/banner.png b/assets/banner.png new file mode 100644 index 0000000..fb42ece Binary files /dev/null and b/assets/banner.png differ diff --git a/assets/bg.jpg b/assets/bg.jpg new file mode 100644 index 0000000..362ec61 Binary files /dev/null and b/assets/bg.jpg differ diff --git a/assets/style.css b/assets/style.css new file mode 100644 index 0000000..767e2ff --- /dev/null +++ b/assets/style.css @@ -0,0 +1,136 @@ +*, +*:before, +*:after { + -webkit-box-sizing: border-box; + box-sizing: border-box; + font-family: 'Open Sans'; +} + +body { + background: -webkit-gradient(linear, left top, left bottom, from(#000000f0), to(#00000070)), url("bg.jpg") no-repeat center center fixed; + background: linear-gradient(#000000f0, #00000070), url("bg.jpg") no-repeat center center fixed; + background-size: cover; + height: 100vh; + margin: 0; + color: #363636; +} + +body #wrapper { + padding-top: 20px; +} + +body a { + font-size: 12px; + color: #363636; + text-decoration: none; +} + +body a:hover { + text-decoration: underline; +} + +body a#home { + display: inline-block; + width: 50%; + text-align: left; +} + +body a#login { + display: inline-block; + width: 50%; + text-align: right; +} + +body #banner { + background-image: url(banner.png); + background-size: contain; + height: 63px; + width: 300px; + margin: 60px auto; +} + +body #footer { + max-width: 500px; + padding: 15px 35px; + font-size: 12px; + background-color: #f0f0f0; + color: #7a7b76; + margin: auto; + text-align: center; +} + +body #footer a { + color: #0066cc; +} + +body #form { + background-color: white; + padding: 20px 40px 30px 40px; + max-width: 500px; + margin: auto; + border-top: 4px solid #0066cc; +} + +body #form h1 { + font-weight: 300; + font-size: 24px; + text-align: center; +} + +body #form p { + text-align: center; +} + +body #form p a { + color: #0066cc; + font-size: inherit; +} + +body #form p.error { + color: #c40233; +} + +body #form label { + display: inline-block; + font-size: 12px; + margin-top: 15px; +} + +body #form input[type='email'], +body #form textarea { + width: 100%; + height: 2.25rem; + border: 1px solid #ededed; + border-bottom-color: #8a8d90; + padding: 5px 8px; +} + +body #form input[type='email']:hover, +body #form textarea:hover { + border-bottom-width: 2px; + border-bottom-color: #0066cc; +} + +body #form textarea { + resize: none; + height: 10rem; +} + +body #form input[type='submit'] { + width: 100%; + background-color: #0066cc; + color: white; + padding: 6px 16px; + border: none; + margin-top: 15px; + cursor: pointer; +} + +body #form input[type='submit']:hover { + background-color: #004080; +} + +body .small { + font-size: 12px; +} +/*# sourceMappingURL=style.css.map */ \ No newline at end of file diff --git a/assets/style.css.map b/assets/style.css.map new file mode 100644 index 0000000..cbdba0d --- /dev/null +++ b/assets/style.css.map @@ -0,0 +1,9 @@ +{ + "version": 3, + "mappings": "AAIA,AAAA,CAAC;AACD,CAAC,AAAA,OAAO;AACR,CAAC,AAAA,MAAM,CAAC;EACN,UAAU,EAAE,UAAU;EACtB,WAAW,EAAE,WAAW;CACzB;;AAED,AAAA,IAAI,CAAC;EACH,UAAU,EAAE,qCAAqC,EAC/C,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK;EAC7C,eAAe,EAAE,KAAK;EACtB,MAAM,EAAE,KAAK;EACb,MAAM,EAAE,CAAC;EACT,KAAK,EAfA,OAAO;CAsIb;;AA7HD,AAQE,IARE,CAQF,QAAQ,CAAC;EACP,WAAW,EAAE,IAAI;CAClB;;AAVH,AAYE,IAZE,CAYF,CAAC,CAAC;EACA,SAAS,EAAE,IAAI;EACf,KAAK,EAvBF,OAAO;EAwBV,eAAe,EAAE,IAAI;CAiBtB;;AAhCH,AAiBI,IAjBA,CAYF,CAAC,AAKE,MAAM,CAAC;EACN,eAAe,EAAE,SAAS;CAC3B;;AAnBL,AAqBI,IArBA,CAYF,CAAC,AASE,KAAK,CAAC;EACL,OAAO,EAAE,YAAY;EACrB,KAAK,EAAE,GAAG;EACV,UAAU,EAAE,IAAI;CACjB;;AAzBL,AA2BI,IA3BA,CAYF,CAAC,AAeE,MAAM,CAAC;EACN,OAAO,EAAE,YAAY;EACrB,KAAK,EAAE,GAAG;EACV,UAAU,EAAE,KAAK;CAClB;;AA/BL,AAkCE,IAlCE,CAkCF,OAAO,CAAC;EACN,gBAAgB,EAAE,eAA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C,CAAK,OAAO,AAAZ;AAxFV,IAAI,CAwDF,KAAK,CAiCH,QAAQ,CAAC;EACP,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,OAAO;EACf,MAAM,EAAE,iBAAiB;EACzB,mBAAmB,EAAE,OAAO;EAC5B,OAAO,EAAE,OAAO;CAMjB;;AApGL,AAgGM,IAhGF,CAwDF,KAAK,CAgCH,KAAK,CAAA,AAAA,IAAC,CAAK,OAAO,AAAZ,CAQH,MAAM;AAhGb,IAAI,CAwDF,KAAK,CAiCH,QAAQ,AAOL,MAAM,CAAC;EACN,mBAAmB,EAAE,GAAG;EACxB,mBAAmB,EA7GlB,OAAO;CA8GT;;AAnGP,AAsGI,IAtGA,CAwDF,KAAK,CA8CH,QAAQ,CAAC;EACP,MAAM,EAAE,IAAI;EACZ,MAAM,EAAE,KAAK;CACd;;AAzGL,AA2GI,IA3GA,CAwDF,KAAK,CAmDH,KAAK,CAAA,AAAA,IAAC,CAAK,QAAQ,AAAb,EAAe;EACnB,KAAK,EAAE,IAAI;EACX,gBAAgB,EAxHb,OAAO;EAyHV,KAAK,EAAE,KAAK;EACZ,OAAO,EAAE,QAAQ;EACjB,MAAM,EAAE,IAAI;EACZ,UAAU,EAAE,IAAI;EAChB,MAAM,EAAE,OAAO;CAKhB;;AAvHL,AAoHM,IApHF,CAwDF,KAAK,CAmDH,KAAK,CAAA,AAAA,IAAC,CAAK,QAAQ,AAAb,CASH,MAAM,CAAC;EACN,gBAAgB,EA/Hb,OAAO;CAgIX;;AAtHP,AA0HE,IA1HE,CA0HF,MAAM,CAAC;EACL,SAAS,EAAE,IAAI;CAChB", + "sources": [ + "style.scss" + ], + "names": [], + "file": "style.css" +} \ No newline at end of file diff --git a/assets/style.scss b/assets/style.scss new file mode 100644 index 0000000..2d60c5c --- /dev/null +++ b/assets/style.scss @@ -0,0 +1,137 @@ +$accent: #0066cc; +$accent-d: #004080; +$text: #363636; + +*, +*:before, +*:after { + box-sizing: border-box; + font-family: 'Open Sans'; +} + +body { + background: linear-gradient(#000000f0, #00000070), + url('bg.jpg') no-repeat center center fixed; + background-size: cover; + height: 100vh; + margin: 0; + color: $text; + + #wrapper { + padding-top: 20px; + } + + a { + font-size: 12px; + color: $text; + text-decoration: none; + + &:hover { + text-decoration: underline; + } + + &#home { + display: inline-block; + width: 50%; + text-align: left; + } + + &#login { + display: inline-block; + width: 50%; + text-align: right; + } + } + + #banner { + background-image: url(banner.png); + background-size: contain; + height: 63px; + width: 300px; + margin: 60px auto; + } + + #footer { + max-width: 500px; + padding: 15px 35px; + font-size: 12px; + background-color: #f0f0f0; + color: #7a7b76; + margin: auto; + text-align: center; + + a { + color: $accent; + } + } + + #form { + background-color: white; + padding: 20px 40px 30px 40px; + max-width: 500px; + margin: auto; + border-top: 4px solid $accent; + + h1 { + font-weight: 300; + font-size: 24px; + text-align: center; + } + + p { + text-align: center; + + a { + color: $accent; + font-size: inherit; + } + + &.error { + color: #c40233; + } + } + + label { + display: inline-block; + font-size: 12px; + margin-top: 15px; + } + + input[type='email'], + textarea { + width: 100%; + height: 2.25rem; + border: 1px solid #ededed; + border-bottom-color: #8a8d90; + padding: 5px 8px; + + &:hover { + border-bottom-width: 2px; + border-bottom-color: $accent; + } + } + + textarea { + resize: none; + height: 10rem; + } + + input[type='submit'] { + width: 100%; + background-color: $accent; + color: white; + padding: 6px 16px; + border: none; + margin-top: 15px; + cursor: pointer; + + &:hover { + background-color: $accent-d; + } + } + } + + .small { + font-size: 12px; + } +} diff --git a/demo.vars.ini b/demo.vars.ini new file mode 100644 index 0000000..51e10fb --- /dev/null +++ b/demo.vars.ini @@ -0,0 +1,12 @@ +page_title = + +this_url = +target_url = + +mail_noreply = +mail_target = + +; include token for Gotify! +gotify_url = +keycloak_url = +keycloak_realm = \ No newline at end of file diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..96d8c30 Binary files /dev/null and b/favicon.ico differ diff --git a/index.php b/index.php new file mode 100644 index 0000000..4da4c77 --- /dev/null +++ b/index.php @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + Anfrage | <?= $ini["page_title"] ?> + + + + + + +
+ +
+ ">← Home/realms//protocol/openid-connect/auth?client_id=requestform&response_type=code">Login + → +

Anfrage

+
+ + + + + + +
+
+ +
+ + + \ No newline at end of file diff --git a/mail.php b/mail.php new file mode 100644 index 0000000..4179dda --- /dev/null +++ b/mail.php @@ -0,0 +1,153 @@ +"; +} +if (strlen(utf8_decode($user)) < 3) { + $error = true; + $errorcode .= "Ungültiger Nutzer.
"; +} +if (strlen(utf8_decode($desc)) < 3) { + $error = true; + $errorcode .= "Ungültige Nachricht.
"; +} + +if (!$error) { + $error = !mail( + $ini["mail_target"], + "RequestForm: Anfrage von $user", + $desc, + implode("\r\n", array( + "MIME-Version: 1.0", + "Content-type: text/plain; charset=utf-8", + "From: " + $ini["mail_noreply"], + "Reply-To: $user <$email>", + "X-Mailer: PHP/" . phpversion(), + )) + ); + if ($error) { + $errorcode .= "Serverseitiges Problem."; + $gotify_data = [ + "title" => "RequestForm: Error", + "message" => "Mail transfer failed.", + "priority" => 1 + ]; + } else { + $gotify_data = [ + "title" => "RequestForm: Anfrage von $user", + "message" => $desc, + "priority" => 5 + ]; + } + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $ini["gotify_url"]); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json; charset=utf-8"]); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($gotify_data)); + + $result = curl_exec($ch); + $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); + + switch ($code) { + case "200": + echo "Your Message was Submitted"; + break; + case "400": + echo "Bad Request"; + break; + case "401": + echo "Unauthorized Error - Invalid Token"; + break; + case "403": + echo "Forbidden"; + break; + case "404": + echo "API URL Not Found"; + break; + default: + echo "Hmm Something Went Wrong or HTTP Status Code is Missing"; + } +} +?> + + + + + + + + + + + + + Anfrage | <?= $ini["page_title"] ?> + + + + + +
+ +
+

Danke!

+

+ Deine Nachricht ist eingegangen und wird demnächst™ bearbeitet. +

+

+ ">Weitere Anfrage +

+
+ +
+ + + + + +
+ +
+

Fehler...

+

+ +

+

+ Wenn der Fehler weiterhin besteht, sende die Anfrage mit deinem eigenen Mailclient ab:

+ ?subject=Anfrage&body="> +

+

+ Deine Nachricht ist im Link enthalten und muss nicht neu verfasst werden. +

+
+ +
+ + + + + \ No newline at end of file diff --git a/remember.txt.ini b/remember.txt.ini new file mode 100644 index 0000000..d3e9234 --- /dev/null +++ b/remember.txt.ini @@ -0,0 +1,14 @@ +// document.location.href = "?user=" + keycloak.idTokenParsed.preferred_username; +console.log('IDToken'); +console.log(keycloak.idTokenParsed.preferred_username); +console.log(keycloak.idTokenParsed.email); +console.log(keycloak.idTokenParsed.name); +console.log(keycloak.idTokenParsed.given_name); +console.log(keycloak.idTokenParsed.family_name); + +console.log('Account Service'); +console.log(keycloak.profile.username); +console.log(keycloak.profile.email); +console.log(keycloak.profile.firstName + ' ' + keycloak.profile.lastName); +console.log(keycloak.profile.firstName); +console.log(keycloak.profile.lastName); \ No newline at end of file