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/login.php | |
| parent | c6cee4ef99447082d0dc64791f35cdfe40c9d810 (diff) | |
| download | gospeladlershof.de-5fd2250f7c9a5be373e5c71f50d0c1e001f80322.tar.gz | |
Testet Passwordless-Login.
Diffstat (limited to 'intern.gospeladlershof.de/code/login.php')
| -rw-r--r-- | intern.gospeladlershof.de/code/login.php | 79 |
1 files changed, 53 insertions, 26 deletions
diff --git a/intern.gospeladlershof.de/code/login.php b/intern.gospeladlershof.de/code/login.php index ba41b1c..002ddd3 100644 --- a/intern.gospeladlershof.de/code/login.php +++ b/intern.gospeladlershof.de/code/login.php @@ -2,45 +2,71 @@ define("LOGIN_SITE", true); require_once __DIR__ . '/session.php'; +require_once __DIR__ . '/../vendor/autoload.php'; +use Pheanstalk\Pheanstalk; -$mail = $_REQUEST["email"]; +$mail = strtolower($_REQUEST["email"]); $passwd = hash("sha512", $_REQUEST["password"]); $addresses= file(__DIR__ . "/../../intern/chor_list_members.txt", FILE_IGNORE_NEW_LINES); -if ( "2397be3187f0ab864802fbe2b6c3207a01328988d524973d4eeaa48928410a2588263882e37e68363691fd8d7c3c83e8ebe46166bee13404ae61484c13b55e1f" === $passwd || - "319e789e0fa1867bb08b197b306cc48aa0a109511f5e36dbdd1ed642cda8b7f222b0b6a31a43d2302d17562734d40eeb1f85cb99b4bf3101b3c7cef490d89ed2" === $passwd || - "bf3da3d012e3ed51eeae20f3d5e37e655dfb9a0a1bcf29fec7d9ff425547de2388d21a4395019e0d433beb1b7f5a9f730535ea85b2ba6de7eb0d84aafb76902a" === $passwd || - "373a3dd664c54f99059c4801f3807bdc16c4c22f208a05a5a3d8e990c3e76d4a96c27ebe6aa2b8db1ca02eee3d5e5a458dc5819e3852952f5b7d5f3e631b6fcf" === $passwd -) { +foreach($addresses as $a) { -/* -if ( $mail === "Chor" || "chor" === $mail ) { - $_SESSION["login"] = true; - $_SESSION["success"] = "Erfolgreich eingeloggt. Der Nutzername 'chor' wird bald deaktiviert. Bitte benutze deine E-Mail-Adresse als Login-Name."; + if ( $mail === strtolower($a) ) { + $hash = chr( mt_rand( 97 ,122 ) ) .substr( md5( time( ) ) ,1 ); + ob_start(); + require __DIR__ . '/template/html_mail.php'; + $htmlmessage = ob_get_clean(); - $_SESSION["dontdisplaydeploybutton"] = 1; - $_SESSION["user"] = $mail; + ob_start(); + require __DIR__ . 'template/text_mail.php'; + $textmessage = ob_get_clean(); - header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect"); - header("Location: /"); + $redis = new Predis\Client([ + 'scheme' => 'tcp', + 'host' => '192.168.122.1', + 'port' => 6379, + 'database' => 2, + ]); - exit; + $redis->set($mail, $hash, "ex", 86400); // hält den Wert für 24h + + $pheanstalk = new Pheanstalk('192.168.122.1'); + + $data = array( + 'To' => $mail, + 'Name' => 'Gospelchor Adlershof', + 'From' => 'noreply@gospeladlershof.de', + 'ReplyTo' => 'webmaster@gospeladlershof.de', + 'Subject' => 'Gospelchor Adlershof | Login', + 'HTMLMessage' => $htmlmessage, + 'TextMessage' => $textmessage, + ); + + $pheanstalk + ->useTube('contactme_mailer') + ->put(json_encode($data)); + + $_SESSION["user"] = $mail; + + error_log(json_encode($data)); + } } - */ - foreach($addresses as $a) { - if ( strtolower($mail) === strtolower($a) ) { - $_SESSION["login"] = true; - $_SESSION["success"] = "Erfolgreich eingeloggt."; - $_SESSION["dontdisplaydeploybutton"] = 1; - $_SESSION["user"] = $mail; +header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect"); +header("Location: /check_login.php"); + + /* + $_SESSION["login"] = true; + $_SESSION["success"] = "Erfolgreich eingeloggt."; + + $_SESSION["dontdisplaydeploybutton"] = 1; + $_SESSION["user"] = $mail; - header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect"); - header("Location: /"); + header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect"); + header("Location: /"); - exit; - } + exit; } } @@ -49,3 +75,4 @@ $_SESSION["error"] = "E-Mail oder Passwort stimmmen nicht überein."; header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect"); header("Location: /login.php"); + */ |
