Skip to content

Commit

Permalink
improve data style
Browse files Browse the repository at this point in the history
  • Loading branch information
voltan committed Dec 11, 2024
1 parent 871f887 commit a02b2d0
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Service/AccountService.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,6 @@ public function postLoginSuccess($account, $params): array
// Get from cache if exist
$user = $this->cacheService->getUser($account['id']);

// Set company to account if exist
$account['company_id'] = $user['authorization']['company_id'] ?? 0;
$account['company_title'] = $user['authorization']['company']['title'] ?? '';

// Set multi factor
$multiFactorGlobal = (int)$this->config['multi_factor']['status'] ?? 0;
$multiFactorStatus = (int)$account['multi_factor_status'] ?? 0;
Expand Down Expand Up @@ -358,8 +354,8 @@ public function postLoginSuccess($account, $params): array
$account['access_token'] = $accessToken['token'];
$account['refresh_token'] = $refreshToken['token'];
$account['is_company_setup'] = false;
$account['company_id'] = 0;
$account['company_title'] = '';
$account['company_id'] = $user['authorization']['company_id'] ?? 0;
$account['company_title'] = $user['authorization']['company']['title'] ?? '';
$account['permission'] = [];
$account['token_payload'] = [
'iat' => $accessToken['payload']['iat'],
Expand Down Expand Up @@ -388,7 +384,7 @@ public function postLoginSuccess($account, $params): array
}

// Check company setup
if (isset($this->config['login']['get_company']) && (int)$this->config['login']['get_company'] === 1) {
if (!$account['is_company_setup'] && isset($this->config['login']['get_company']) && (int)$this->config['login']['get_company'] === 1) {
$isCompanySetup = false;
if (isset($user['authorization']['company']['is_company_setup'])) {
$isCompanySetup = $user['authorization']['company']['is_company_setup'];
Expand Down

0 comments on commit a02b2d0

Please sign in to comment.