Przeglądaj źródła

catch error 'no be user for ...' at auth

Olivier Massot 9 miesięcy temu
rodzic
commit
bdeb209eef

+ 6 - 2
ot_connect/Classes/Service/OtAuthenticationService.php

@@ -162,7 +162,11 @@ class OtAuthenticationService extends AbstractAuthenticationService
         //   generated in the last minutes, to avoid unnecessary operations *
 
         if ($this->shouldUserBeUpdated($username, $isBackend)) {
-            $wasUpdated = $this->createOrUpdateUser($isBackend);
+            try {
+                $wasUpdated = $this->createOrUpdateUser($isBackend);
+            } catch (\RuntimeException) {
+                $wasUpdated = false;
+            }
 
             if (!$wasUpdated) {
                 // An error happened during the update of the user's data
@@ -414,7 +418,7 @@ class OtAuthenticationService extends AbstractAuthenticationService
         }
 
         if ($isBackend && empty($groupsUid)) {
-            throw new \Exception("No BE_group found for user " . $userApiData['username']);
+            throw new \RuntimeException("No BE_group found for user " . $userApiData['username']);
         }
 
         $user_row['usergroup'] = join(',', $groupsUid);