diff options
| author | horus_arch | 2017-02-20 13:48:50 +0100 |
|---|---|---|
| committer | horus_arch | 2017-02-20 13:48:50 +0100 |
| commit | 5fd2250f7c9a5be373e5c71f50d0c1e001f80322 (patch) | |
| tree | 4002d553fa82dbf79ca347f1ad0a3d02934b8726 /intern.gospeladlershof.de/code/check_login.php | |
| parent | c6cee4ef99447082d0dc64791f35cdfe40c9d810 (diff) | |
| download | gospeladlershof.de-5fd2250f7c9a5be373e5c71f50d0c1e001f80322.tar.gz | |
Testet Passwordless-Login.
Diffstat (limited to 'intern.gospeladlershof.de/code/check_login.php')
| -rw-r--r-- | intern.gospeladlershof.de/code/check_login.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/intern.gospeladlershof.de/code/check_login.php b/intern.gospeladlershof.de/code/check_login.php new file mode 100644 index 0000000..0ea8ecd --- /dev/null +++ b/intern.gospeladlershof.de/code/check_login.php @@ -0,0 +1,37 @@ +<?php + +define("LOGIN_SITE", true); +require_once __DIR__ . '/session.php'; +require_once __DIR__ . '/../vendor/autoload.php'; + +$mail = strtolower($_REQUEST["email"]); +$hash = $_REQUEST["hash"]; + +$redis = new Predis\Client([ + 'scheme' => 'tcp', + 'host' => '192.168.122.1', + 'port' => 6379, + 'database' => 2, +]); + +$correct_hash = $redis->get($mail); + +if ( $hash === $correct_hash ) { + $_SESSION["login"] = true; + $_SESSION["success"] = "Erfolgreich eingeloggt."; + $_SESSION["user"] = $mail; + + $_SESSION["dontdisplaydeploybutton"] = 1; + + header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect"); + header("Location: /"); + + exit; +} else { + + $_SESSION["login"] = false; + $_SESSION["error"] = "Entweder kennen wir deine E-Mail nicht oder du hast den Code falsch kopiert."; + + header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect"); + header("Location: /login.php"); +} |
