Speichere Login-Methode in der Session
Bernd Wurst

Bernd Wurst commited on 2023-12-09 07:35:23
Zeige 5 geänderte Dateien mit 7 Einfügungen und 6 Löschungen.

... ...
@@ -50,7 +50,7 @@ if (isset($_REQUEST['token'])) {
50 50
                 invalidate_systemuser_token($uid);
51 51
                 $_SESSION['role'] = find_role($uid, '', true);
52 52
                 ;
53
-                setup_session($_SESSION['role'], $uid);
53
+                setup_session($_SESSION['role'], $uid, 'initialize');
54 54
                 success_msg('Das Passwort wurde gesetzt!');
55 55
                 redirect('index');
56 56
             }
... ...
@@ -102,7 +102,7 @@ if ($req == 'getCreateArgs') {
102 102
             $uid = $savedData['uid'];
103 103
             require_once("session/start.php");
104 104
             $role = find_role($uid, '', true);
105
-            setup_session($role, $uid);
105
+            setup_session($role, $uid, 'passkey');
106 106
             die();
107 107
         } else {
108 108
             success_msg("Die Identifikation mit dem Passkey »{$savedData['handle']}« hat funktioniert!");
... ...
@@ -21,12 +21,12 @@ if (!isset($_SESSION['admin_user'])) {
21 21
 $admin_user = $_SESSION['admin_user'];
22 22
 $role = find_role($admin_user, '', true);
23 23
 if ($role & ROLE_SYSADMIN) {
24
-    setup_session($role, $admin_user);
24
+    setup_session($role, $admin_user, 'su_return');
25 25
     unset($_SESSION['admin_user']);
26 26
     header('Location: ' . $prefix . 'go/su/su');
27 27
     die();
28 28
 } elseif ($role & ROLE_CUSTOMER) {
29
-    setup_session($role, $admin_user);
29
+    setup_session($role, $admin_user, 'su_return');
30 30
     unset($_SESSION['admin_user']);
31 31
     header('Location: ' . $prefix . 'go/su/su_customer');
32 32
     die();
... ...
@@ -163,7 +163,7 @@ function su($type, $id)
163 163
         unset($_SESSION['admin_user']);
164 164
         return false;
165 165
     }
166
-    setup_session($role, $id);
166
+    setup_session($role, $id, 'su');
167 167
     if ($type == 'c') {
168 168
         if (!(ROLE_CUSTOMER & $_SESSION['role'])) {
169 169
             session_destroy();
... ...
@@ -285,9 +285,10 @@ function user_for_vmail_account($account)
285 285
 }
286 286
 
287 287
 
288
-function setup_session($role, $useridentity)
288
+function setup_session($role, $useridentity, $loginmethod = 'password')
289 289
 {
290 290
     session_regenerate_id();
291
+    $_SESSION['loginmethod'] = $loginmethod;
291 292
     $_SESSION['role'] = $role;
292 293
     if ($role & ROLE_SUBUSER) {
293 294
         DEBUG("We are a sub-user");
294 295