This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php namespace Modules\User\Repositories\Sentinel; |
||
2 | |||
3 | use Cartalyst\Sentinel\Checkpoints\NotActivatedException; |
||
4 | use Cartalyst\Sentinel\Checkpoints\ThrottlingException; |
||
5 | use Cartalyst\Sentinel\Laravel\Facades\Activation; |
||
6 | use Cartalyst\Sentinel\Laravel\Facades\Reminder; |
||
7 | use Cartalyst\Sentinel\Laravel\Facades\Sentinel; |
||
8 | use Modules\Core\Contracts\Authentication; |
||
9 | use Modules\User\Events\UserHasActivatedAccount; |
||
10 | |||
11 | class SentinelAuthentication implements Authentication |
||
12 | { |
||
13 | /** |
||
14 | * Authenticate a user |
||
15 | * @param array $credentials |
||
16 | * @param bool $remember Remember the user |
||
17 | * @return mixed |
||
18 | */ |
||
19 | public function login(array $credentials, $remember = false) |
||
20 | { |
||
21 | try { |
||
22 | if (Sentinel::authenticate($credentials, $remember)) { |
||
23 | return false; |
||
24 | } |
||
25 | |||
26 | return 'Invalid login or password.'; |
||
27 | } catch (NotActivatedException $e) { |
||
0 ignored issues
–
show
|
|||
28 | return 'Account not yet validated. Please check your email.'; |
||
29 | } catch (ThrottlingException $e) { |
||
0 ignored issues
–
show
The class
Cartalyst\Sentinel\Checkpoints\ThrottlingException does not exist. Did you forget a USE statement, or did you not list all dependencies?
Scrutinizer analyzes your It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis. ![]() |
|||
30 | $delay = $e->getDelay(); |
||
31 | |||
32 | return "Your account is blocked for {$delay} second(s)."; |
||
33 | } |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Register a new user. |
||
38 | * @param array $user |
||
39 | * @return bool |
||
40 | */ |
||
41 | public function register(array $user) |
||
42 | { |
||
43 | return Sentinel::getUserRepository()->create((array) $user); |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * Assign a role to the given user. |
||
48 | * @param \Modules\User\Repositories\UserRepository $user |
||
49 | * @param \Modules\User\Repositories\RoleRepository $role |
||
50 | * @return mixed |
||
51 | */ |
||
52 | public function assignRole($user, $role) |
||
53 | { |
||
54 | return $role->users()->attach($user); |
||
0 ignored issues
–
show
The method
users() does not seem to exist on object<Modules\User\Repositories\RoleRepository> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
55 | } |
||
56 | |||
57 | /** |
||
58 | * Log the user out of the application. |
||
59 | * @return bool |
||
60 | */ |
||
61 | public function logout() |
||
62 | { |
||
63 | return Sentinel::logout(); |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * Activate the given used id |
||
68 | * @param int $userId |
||
69 | * @param string $code |
||
70 | * @return mixed |
||
71 | */ |
||
72 | public function activate($userId, $code) |
||
73 | { |
||
74 | $user = Sentinel::findById($userId); |
||
75 | |||
76 | $success = Activation::complete($user, $code); |
||
77 | if ($success) { |
||
78 | event(new UserHasActivatedAccount($user)); |
||
79 | } |
||
80 | |||
81 | return $success; |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * Create an activation code for the given user |
||
86 | * @param \Modules\User\Repositories\UserRepository $user |
||
87 | * @return mixed |
||
88 | */ |
||
89 | public function createActivation($user) |
||
90 | { |
||
91 | return Activation::create($user)->code; |
||
92 | } |
||
93 | |||
94 | /** |
||
95 | * Create a reminders code for the given user |
||
96 | * @param \Modules\User\Repositories\UserRepository $user |
||
97 | * @return mixed |
||
98 | */ |
||
99 | public function createReminderCode($user) |
||
100 | { |
||
101 | $reminder = Reminder::exists($user) ?: Reminder::create($user); |
||
102 | |||
103 | return $reminder->code; |
||
104 | } |
||
105 | |||
106 | /** |
||
107 | * Completes the reset password process |
||
108 | * @param $user |
||
109 | * @param string $code |
||
110 | * @param string $password |
||
111 | * @return bool |
||
112 | */ |
||
113 | public function completeResetPassword($user, $code, $password) |
||
114 | { |
||
115 | return Reminder::complete($user, $code, $password); |
||
116 | } |
||
117 | |||
118 | /** |
||
119 | * Determines if the current user has access to given permission |
||
120 | * @param $permission |
||
121 | * @return bool |
||
122 | */ |
||
123 | public function hasAccess($permission) |
||
124 | { |
||
125 | if (! Sentinel::check()) { |
||
126 | return false; |
||
127 | } |
||
128 | |||
129 | return Sentinel::hasAccess($permission); |
||
130 | } |
||
131 | |||
132 | /** |
||
133 | * Check if the user is logged in |
||
134 | * @return mixed |
||
135 | */ |
||
136 | public function check() |
||
137 | { |
||
138 | return Sentinel::check(); |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | * Get the ID for the currently authenticated user |
||
143 | * @return int |
||
144 | */ |
||
145 | public function id() |
||
146 | { |
||
147 | if (! $user = $this->check()) { |
||
148 | return; |
||
149 | } |
||
150 | |||
151 | return $user->id; |
||
152 | } |
||
153 | } |
||
154 |
Scrutinizer analyzes your
composer.json
/composer.lock
file if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.