@@ -15,8 +15,9 @@ discard block |
||
15 | 15 | public function __construct(private EntityManagerInterface $manager, private UserPasswordEncoderInterface $encoder) {} |
16 | 16 | public function changePassword(User $user, $password) |
17 | 17 | { |
18 | - if (!$this->getPermission()) |
|
19 | - throw new Exception("You should not pass!!!", 301); |
|
18 | + if (!$this->getPermission()) { |
|
19 | + throw new Exception("You should not pass!!!", 301); |
|
20 | + } |
|
20 | 21 | |
21 | 22 | $user->setHash( |
22 | 23 | $this->encoder->encodePassword($user, $password) |
@@ -29,8 +30,9 @@ discard block |
||
29 | 30 | |
30 | 31 | public function changeApiKey(User $user) |
31 | 32 | { |
32 | - if (!$this->getPermission()) |
|
33 | - throw new Exception("You should not pass!!!", 301); |
|
33 | + if (!$this->getPermission()) { |
|
34 | + throw new Exception("You should not pass!!!", 301); |
|
35 | + } |
|
34 | 36 | |
35 | 37 | $user->generateApiKey(); |
36 | 38 | |
@@ -51,8 +53,9 @@ discard block |
||
51 | 53 | |
52 | 54 | $people = $this->discoveryPeople($email, $firstName, $lastName); |
53 | 55 | |
54 | - if (!$user) |
|
55 | - $user = $this->createUser($people, $email, $password); |
|
56 | + if (!$user) { |
|
57 | + $user = $this->createUser($people, $email, $password); |
|
58 | + } |
|
56 | 59 | |
57 | 60 | return $user; |
58 | 61 | } |
@@ -93,8 +96,9 @@ discard block |
||
93 | 96 | |
94 | 97 | public function createUser(People $people, $username, $password) |
95 | 98 | { |
96 | - if (!$this->getPermission()) |
|
97 | - throw new Exception("You should not pass!!!", 301); |
|
99 | + if (!$this->getPermission()) { |
|
100 | + throw new Exception("You should not pass!!!", 301); |
|
101 | + } |
|
98 | 102 | |
99 | 103 | $user = new User(); |
100 | 104 | $user->setPeople($people); |
@@ -111,8 +115,9 @@ discard block |
||
111 | 115 | { |
112 | 116 | $peopleLink = $user->getPeople()->getLink()->first(); |
113 | 117 | |
114 | - if ($peopleLink !== false && $peopleLink->getCompany() instanceof People) |
|
115 | - return $peopleLink->getCompany(); |
|
118 | + if ($peopleLink !== false && $peopleLink->getCompany() instanceof People) { |
|
119 | + return $peopleLink->getCompany(); |
|
120 | + } |
|
116 | 121 | } |
117 | 122 | |
118 | 123 | public function getCompanyId(User $user) |
@@ -34,20 +34,23 @@ |
||
34 | 34 | try { |
35 | 35 | |
36 | 36 | |
37 | - if ($request->get('code')) |
|
38 | - $token = $this->provider->getAccessToken('authorization_code', [ |
|
37 | + if ($request->get('code')) { |
|
38 | + $token = $this->provider->getAccessToken('authorization_code', [ |
|
39 | 39 | 'code' => $request->get('code') |
40 | 40 | ]); |
41 | + } |
|
41 | 42 | |
42 | - if ($request->get('access_token')) |
|
43 | - $token = new AccessToken([ |
|
43 | + if ($request->get('access_token')) { |
|
44 | + $token = new AccessToken([ |
|
44 | 45 | 'access_token' => $request->get('access_token'), |
45 | 46 | ]); |
47 | + } |
|
46 | 48 | |
47 | - if ($request->get('code')) |
|
48 | - $token = $this->provider->getAccessToken('authorization_code', [ |
|
49 | + if ($request->get('code')) { |
|
50 | + $token = $this->provider->getAccessToken('authorization_code', [ |
|
49 | 51 | 'code' => $request->get('code') |
50 | 52 | ]); |
53 | + } |
|
51 | 54 | |
52 | 55 | $ownerDetails = $this->provider->getResourceOwner($token); |
53 | 56 |