e20e4af2563d82aa13647686c54c3318bda8e224
bernd webinterface => /webinterface

bernd authored 17 years ago

1) <?php
2) /*
3) 
4)   Session-Start-Script wird vom dispatcher eingebunden
5) 
6) */
7) 
8) require_once('session/checkuser.php');
9) require_once('inc/error.php');
10) require_once('inc/debug.php');
11) 
bernd Logging aktiviert

bernd authored 16 years ago

12) require_once('inc/base.php');
13) 
bernd Session-Name aus einer Conf...

bernd authored 13 years ago

14) session_name(config('session_name'));
bernd Cookie einen eindeutigen Na...

bernd authored 16 years ago

15) 
Hanno Böck Samesite-Cookies an (CSRF-P...

Hanno Böck authored 4 years ago

16) session_set_cookie_params(array('path' => '/', 'secure' => true,
17)                                 'httponly' => true, 'samesite' => 'Lax'));
bernd sichere cookies

bernd authored 15 years ago

18) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

19) if (!session_start()) {
20)     logger(LOG_ERR, "session/start", "session", "Die session konnte nicht gestartet werden!");
21)     system_failure('Die Sitzung konnte nicht gestartet werden, bitte benachrichtigen Sie den Administrator!');
bernd Logging aktiviert

bernd authored 16 years ago

22) }
bernd webinterface => /webinterface

bernd authored 17 years ago

23) 
hanno nochmal entities:specialchars

hanno authored 16 years ago

24) DEBUG("<pre>POST-DATA: ".htmlspecialchars(print_r($_POST, true))."\nSESSION_DATA: ".htmlspecialchars(print_r($_SESSION, true))."</pre>");
bernd webinterface => /webinterface

bernd authored 17 years ago

25) 
Bernd Wurst Umbenennung Google-Auth nac...

Bernd Wurst authored 11 years ago

26) if (have_module('webmailtotp') && isset($_POST['webinterface_totpcode']) && isset($_SESSION['totp']) && isset($_SESSION['totp_username'])) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

27)     require_once('modules/webmailtotp/include/totp.php');
28)     $role = null;
29)     if (check_totp($_SESSION['totp_username'], $_POST['webinterface_totpcode'])) {
30)         $role = find_role($_SESSION['totp_username'], '', true);
31)     }
32)     if ($role === null) {
33)         $_SESSION['role'] = ROLE_ANONYMOUS;
34)         logger(LOG_WARNING, "session/start", "login", "wrong totp code (username: »{$_SESSION['totp_username']}«)");
35)         warning('Ihre Anmeldung konnte nicht durchgeführt werden. Geben Sie bitte einen neuen Code ein.');
36)         show_page('webmailtotp-login');
37)         die();
38)     } else {
39)         setup_session($role, $_SESSION['totp_username']);
40)     }
41)     unset($_POST['webinterface_totpcode']);
42)     unset($_SESSION['totp']);
43)     unset($_SESSION['totp_username']);
Bernd Wurst Login am Webiterface mit Go...

Bernd Wurst authored 11 years ago

44) }
45) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

46) if (isset($_POST['webinterface_username']) && isset($_POST['webinterface_password'])) {
47)     $role = find_role($_POST['webinterface_username'], $_POST['webinterface_password']);
48)     if ($role === null) {
49)         $_SESSION['role'] = ROLE_ANONYMOUS;
50)         logger(LOG_WARNING, "session/start", "login", "wrong user data (username: »{$_POST['webinterface_username']}«)");
51)         login_screen('Ihre Anmeldung konnte nicht durchgeführt werden. Vermutlich haben Sie falsche Zugangsdaten eingegeben.');
52)     } else {
53)         setup_session($role, $_POST['webinterface_username']);
Bernd Wurst warn about weak password an...

Bernd Wurst authored 4 years ago

54)         if (isset($_POST['webinterface_password'])) {
55)             $result = strong_password($_POST['webinterface_password']);
56)             if ($result !== true) {
Bernd Wurst fixed formatstring error

Bernd Wurst authored 4 years ago

57)                 logger(LOG_WARNING, "session/start", "login", "weak password detected for ".$_POST['webinterface_username']);
Bernd Wurst warn about weak password an...

Bernd Wurst authored 4 years ago

58)                 warning('Unsere Überprüfung hat ergeben, dass Ihr Passwort in bisher veröffentlichten Passwortlisten enthalten ist, es ist daher als unsicher zu betrachten. Bitte ändern Sie Ihr Passwort bei Gelegenheit.');
59)                 if ($role & (ROLE_VMAIL_ACCOUNT | ROLE_MAILACCOUNT)) {
60)                     redirect($prefix.'go/email/chpass');
61)                 } else {
62)                     redirect($prefix.'go/index/chpass');
63)                 }
64)             }
65)         }
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

66)     }
67)     unset($_POST['webinterface_username']);
68)     unset($_POST['webinterface_password']);
69) } elseif (isset($_SESSION['role'])) {
70)     /* User ist eingeloggt (aber vielleicht als ROLE_ANONYMOUS!) */
71) } else {
bernd webinterface => /webinterface

bernd authored 17 years ago

72)     $_SESSION['role'] = ROLE_ANONYMOUS;
73) }
74) // Wenn wir hier sind, ist der Benutzer eingeloggt. Möglicherweise nur als ANONYMOUS
75)