master
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) 
Hanno Böck Use generic session name an...

Hanno Böck authored 2 weeks ago

14) // __Host- prefix guarantees secure cookie that cannot be
15) // overwritten by other hosts:
16) // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis
17) session_name('__Host-CONFIG_INTERFACE');
bernd Cookie einen eindeutigen Na...

bernd authored 16 years ago

18) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

19) session_set_cookie_params(['path' => '/', 'secure' => true,
Hanno Böck Neue codingstyle-rule array...

Hanno Böck authored 6 days ago

20)     'httponly' => true, 'samesite' => 'Lax', ]);
bernd sichere cookies

bernd authored 15 years ago

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

Hanno authored 5 years ago

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

bernd authored 16 years ago

25) }
bernd webinterface => /webinterface

bernd authored 17 years ago

26) 
Hanno Böck Spaces between string conca...

Hanno Böck authored 4 months ago

27) 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

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

Bernd Wurst authored 11 years ago

29) 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

30)     require_once('modules/webmailtotp/include/totp.php');
31)     $role = null;
32)     if (check_totp($_SESSION['totp_username'], $_POST['webinterface_totpcode'])) {
33)         $role = find_role($_SESSION['totp_username'], '', true);
34)     }
35)     if ($role === null) {
36)         $_SESSION['role'] = ROLE_ANONYMOUS;
37)         logger(LOG_WARNING, "session/start", "login", "wrong totp code (username: »{$_SESSION['totp_username']}«)");
38)         warning('Ihre Anmeldung konnte nicht durchgeführt werden. Geben Sie bitte einen neuen Code ein.');
Bernd Wurst Code für 2-FA mit TOTP vorl...

Bernd Wurst authored 3 months ago

39)         show_page('totp-login');
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

40)         die();
41)     } else {
42)         setup_session($role, $_SESSION['totp_username']);
43)     }
44)     unset($_POST['webinterface_totpcode']);
45)     unset($_SESSION['totp']);
46)     unset($_SESSION['totp_username']);
Bernd Wurst Login am Webiterface mit Go...

Bernd Wurst authored 11 years ago

47) }
48) 
Bernd Wurst Deprecation-Fehler bei TOTP...

Bernd Wurst authored 4 months ago

49) if (isset($_POST['webinterface_username']) && $_POST['webinterface_username'] != '' && isset($_POST['webinterface_password']) && $_POST['webinterface_password'] != '') {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

50)     check_input_types($_POST, ['webinterface_username' => 'string', 'webinterface_password' => 'string']);
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

Bernd Wurst authored 4 years ago

58)         if (isset($_POST['webinterface_password'])) {
59)             $result = strong_password($_POST['webinterface_password']);
60)             if ($result !== true) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 4 months ago

61)                 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

62)                 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.');
63)                 if ($role & (ROLE_VMAIL_ACCOUNT | ROLE_MAILACCOUNT)) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 4 months ago

64)                     redirect($prefix . 'go/email/chpass');
Bernd Wurst warn about weak password an...

Bernd Wurst authored 4 years ago

65)                 } else {
Hanno Böck Spaces between string conca...

Hanno Böck authored 4 months ago

66)                     redirect($prefix . 'go/index/chpass');
Bernd Wurst warn about weak password an...

Bernd Wurst authored 4 years ago

67)                 }
68)             }
69)         }
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

bernd authored 17 years ago

76)     $_SESSION['role'] = ROLE_ANONYMOUS;
77) }
78) // Wenn wir hier sind, ist der Benutzer eingeloggt. Möglicherweise nur als ANONYMOUS
79) 
bernd Menü-Includes sinnvoller /...

bernd authored 16 years ago

80)