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 |
||
2 | |||
3 | use CMSFactory\Events; |
||
4 | |||
5 | (defined('BASEPATH')) OR exit('No direct script access allowed'); |
||
6 | |||
7 | /** |
||
8 | * Implements public API methods for Auth class |
||
9 | * All methods return json objects in one format |
||
10 | * |
||
11 | * @author Avgustus |
||
12 | * @copyright ImageCMS (c) 2013, Avgustus <[email protected]> |
||
13 | * |
||
14 | */ |
||
15 | class Authapi extends MY_Controller |
||
16 | { |
||
17 | |||
18 | private $min_username = null; |
||
19 | |||
20 | private $max_username = null; |
||
21 | |||
22 | private $min_password = null; |
||
23 | |||
24 | private $max_password = null; |
||
25 | |||
26 | public function __construct() { |
||
27 | parent::__construct(); |
||
28 | $lang = new MY_Lang(); |
||
29 | $lang->load('auth'); |
||
30 | |||
31 | $this->initialize(); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * Provides user login |
||
36 | * @return json |
||
0 ignored issues
–
show
|
|||
37 | * @access public |
||
38 | * @copyright ImageCMS (c) 2013 |
||
39 | */ |
||
40 | public function login() { |
||
41 | if (!$this->dx_auth->is_logged_in()) { |
||
42 | |||
43 | $this->form_validation->set_message('required', lang('The %s is required', 'auth')); |
||
44 | /** Set form validation rules */ |
||
45 | $this->form_validation->set_rules('email', lang('E-Mail Address', 'auth'), 'trim|required|min_length[3]|xss_clean|valid_email|callback_email_check_for_login'); |
||
46 | $this->form_validation->set_rules('password', lang('Password', 'auth'), 'trim|required|min_length[3]|max_length[30]|xss_clean'); |
||
47 | $this->form_validation->set_rules('remember', lang('Remeber me', 'auth'), 'integer'); |
||
48 | $this->form_validation->set_rules('redirect_to', lang('Redirect to', 'auth'), 'trim|min_length[3]|max_length[255]|xss_clean'); |
||
49 | |||
50 | /** Validate rules and change password */ |
||
51 | $validationResult = $this->form_validation->run(); |
||
52 | $doLoginResult = $this->dx_auth->login($this->input->post('email'), $this->input->post('password'), $this->input->post('remember')); |
||
53 | |||
54 | /** Prepare response */ |
||
55 | if (true === $validationResult AND true === $doLoginResult) { |
||
56 | if (class_exists('ShopCore') && SHOP_INSTALLED) { |
||
57 | ShopCore::app()->SCart->transferCartData(); |
||
58 | } |
||
59 | $jsonResponse['msg'] = lang('User successfully logged in', 'auth'); |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
$jsonResponse was never initialized. Although not strictly required by PHP, it is generally a good practice to add $jsonResponse = array(); before regardless.
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code. Let’s take a look at an example: foreach ($collection as $item) {
$myArray['foo'] = $item->getFoo();
if ($item->hasBar()) {
$myArray['bar'] = $item->getBar();
}
// do something with $myArray
}
As you can see in this example, the array This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop. ![]() |
|||
60 | $jsonResponse['status'] = true; |
||
61 | $jsonResponse['refresh'] = true; |
||
62 | $jsonResponse['redirect'] = FAlSE; |
||
63 | } else { |
||
64 | |||
65 | /** Check if the user is failed logged in because user is banned user or not */ |
||
66 | if ($this->dx_auth->is_banned()) { |
||
67 | $this->ban_reason = $this->dx_auth->get_ban_reason(); |
||
68 | $this->banned(); |
||
69 | exit; |
||
70 | } else { |
||
71 | |||
72 | $validationResult = validation_errors(); |
||
73 | if (empty($validationResult)) { |
||
74 | $jsonResponse['msg'] = lang('User with this name and password is not found', 'auth'); |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
$jsonResponse was never initialized. Although not strictly required by PHP, it is generally a good practice to add $jsonResponse = array(); before regardless.
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code. Let’s take a look at an example: foreach ($collection as $item) {
$myArray['foo'] = $item->getFoo();
if ($item->hasBar()) {
$myArray['bar'] = $item->getBar();
}
// do something with $myArray
}
As you can see in this example, the array This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop. ![]() |
|||
75 | $jsonResponse['validations'] = ['email' => lang('User with this name and password is not found', 'auth')]; |
||
76 | } else { |
||
77 | $jsonResponse['msg'] = $validationResult; |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
$jsonResponse was never initialized. Although not strictly required by PHP, it is generally a good practice to add $jsonResponse = array(); before regardless.
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code. Let’s take a look at an example: foreach ($collection as $item) {
$myArray['foo'] = $item->getFoo();
if ($item->hasBar()) {
$myArray['bar'] = $item->getBar();
}
// do something with $myArray
}
As you can see in this example, the array This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop. ![]() |
|||
78 | $jsonResponse['validations'] = [ |
||
79 | 'email' => form_error('email'), |
||
80 | 'password' => form_error('password'), |
||
81 | 'remember' => form_error('remember'), |
||
82 | ]; |
||
83 | } |
||
84 | |||
85 | /** Return json data for render login form */ |
||
86 | $jsonResponse['status'] = false; |
||
87 | $jsonResponse['refresh'] = false; |
||
88 | $jsonResponse['redirect'] = false; |
||
89 | } |
||
90 | } |
||
91 | } else { |
||
92 | $jsonResponse['refresh'] = false; |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
$jsonResponse was never initialized. Although not strictly required by PHP, it is generally a good practice to add $jsonResponse = array(); before regardless.
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code. Let’s take a look at an example: foreach ($collection as $item) {
$myArray['foo'] = $item->getFoo();
if ($item->hasBar()) {
$myArray['bar'] = $item->getBar();
}
// do something with $myArray
}
As you can see in this example, the array This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop. ![]() |
|||
93 | $jsonResponse['redirect'] = false; |
||
94 | $jsonResponse['status'] = false; |
||
95 | $jsonResponse['msg'] = lang('User is already logged in', 'auth'); |
||
96 | } |
||
97 | |||
98 | /** return JSON Data */ |
||
99 | echo json_encode($jsonResponse); |
||
100 | } |
||
101 | |||
102 | /** |
||
103 | * Provides user logout |
||
104 | * To make logout user has to be loggen in |
||
105 | * @return string |
||
106 | * @access public |
||
107 | * @copyright ImageCMS (c) 2013 |
||
108 | */ |
||
109 | public function logout() { |
||
110 | /** Preprate Variables */ |
||
111 | $jsonResponse = []; |
||
112 | |||
113 | if ($this->dx_auth->is_logged_in()) { |
||
114 | /** Do logout */ |
||
115 | $this->dx_auth->logout(); |
||
116 | |||
117 | /** Preprate response */ |
||
118 | $jsonResponse['msg'] = lang('Logout completed', 'auth'); |
||
119 | $jsonResponse['status'] = TRUE; |
||
120 | $jsonResponse['refresh'] = TRUE; |
||
121 | $jsonResponse['redirect'] = FALSE; |
||
122 | } else { |
||
123 | /** Preprate response */ |
||
124 | $jsonResponse['msg'] = lang('You are not loggin to make loggout', 'auth'); |
||
125 | $jsonResponse['status'] = false; |
||
126 | } |
||
127 | |||
128 | /** return JSON Data */ |
||
129 | return json_encode($jsonResponse); |
||
130 | } |
||
131 | |||
132 | /** |
||
133 | * Provides user register |
||
134 | * |
||
135 | * required: |
||
136 | |||
137 | * @password |
||
138 | * @confirm_password |
||
139 | */ |
||
140 | public function register() { |
||
141 | if (!$this->dx_auth->is_logged_in() AND $this->dx_auth->allow_registration) { |
||
142 | $val = $this->form_validation; |
||
143 | // Set form validation rules |
||
144 | $this->form_validation->set_message('required', lang('The %s is required', 'auth')); |
||
145 | |||
146 | $val->set_rules('email', lang('E-mail', 'auth'), 'trim|required|xss_clean|valid_email|callback_email_check'); |
||
147 | $val->set_rules('username', lang('Your name field', 'auth'), 'required|trim|min_length[2]|xss_clean'); |
||
148 | $val->set_rules('password', lang('Password', 'auth'), 'trim|required|xss_clean|min_length[' . $this->min_password . ']|max_length[' . $this->max_password . ']|matches[confirm_password]'); |
||
149 | $val->set_rules('confirm_password', lang('Password Confirm field', 'auth'), 'trim|required|xss_clean'); |
||
150 | |||
151 | /** Проверка по кастомным полям */ |
||
152 | View Code Duplication | foreach (ShopCore::app()->CustomFieldsHelper->getCustomFielsdAsArray('user') as $item) { |
|
153 | |||
154 | if ($item['is_active'] == 1) { |
||
155 | if ($item['is_required'] == 1) { |
||
156 | $val->set_rules('custom_field['. $item['id'] .']', lang($item['field_name']), 'trim|xss_clean|required'); |
||
157 | } else { |
||
158 | $val->set_rules('custom_field['. $item['id'] .']', lang($item['field_name']), 'trim|xss_clean'); |
||
159 | } |
||
160 | } |
||
161 | } |
||
162 | |||
163 | View Code Duplication | if ($this->dx_auth->captcha_registration) { |
|
164 | if ($this->dx_auth->use_recaptcha) { |
||
165 | $val->set_rules('recaptcha_response_field', lang('Code protection', 'auth'), 'trim|xss_clean|required|callback_captcha_check'); |
||
166 | } else { |
||
167 | $val->set_rules('captcha', lang('Code protection', 'auth'), 'trim|xss_clean|required|callback_captcha_check'); |
||
168 | } |
||
169 | } |
||
170 | // Run form validation and register user if it's pass the validation |
||
171 | $this->load->helper('string'); |
||
172 | $key = random_string('alnum', 5); |
||
173 | if ($val->run($this) AND $last_user = $this->dx_auth->register($val->set_value('username'), $val->set_value('password'), $val->set_value('email'), '', $key, '')) { |
||
174 | // Set success message accordingly |
||
175 | View Code Duplication | if ($this->dx_auth->email_activation) { |
|
176 | $data['auth_message'] = lang('You have successfully registered. Please check your email to activate your account.', 'auth'); |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
$data was never initialized. Although not strictly required by PHP, it is generally a good practice to add $data = array(); before regardless.
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code. Let’s take a look at an example: foreach ($collection as $item) {
$myArray['foo'] = $item->getFoo();
if ($item->hasBar()) {
$myArray['bar'] = $item->getBar();
}
// do something with $myArray
}
As you can see in this example, the array This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop. ![]() |
|||
177 | } else { |
||
178 | $data['auth_message'] = lang('You have successfully registered. ', 'auth') . anchor(site_url($this->dx_auth->login_uri), lang('Login', 'auth')); |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
$data was never initialized. Although not strictly required by PHP, it is generally a good practice to add $data = array(); before regardless.
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code. Let’s take a look at an example: foreach ($collection as $item) {
$myArray['foo'] = $item->getFoo();
if ($item->hasBar()) {
$myArray['bar'] = $item->getBar();
}
// do something with $myArray
}
As you can see in this example, the array This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop. ![]() |
|||
179 | } |
||
180 | |||
181 | Events::create()->registerEvent($last_user, 'AuthUser:register'); |
||
182 | Events::create()->runFactory(); |
||
183 | |||
184 | //create json array for ajax request |
||
185 | $json = []; |
||
186 | $json['status'] = true; |
||
187 | $json['msg'] = lang('Register success', 'auth'); |
||
188 | $json['refresh'] = $this->input->post('refresh') ?: false; |
||
189 | $json['redirect'] = $this->input->post('redirect') ?: false; |
||
190 | |||
191 | echo json_encode($json); |
||
192 | } else { |
||
193 | // Is registration using captcha |
||
194 | if ($this->dx_auth->captcha_registration) { |
||
195 | $this->dx_auth->captcha(); |
||
196 | $this->template->assign('cap_image', $this->dx_auth->get_captcha_image()); |
||
197 | } |
||
198 | //create json array for ajax requests |
||
199 | $json = []; |
||
200 | if ($this->dx_auth->captcha_registration) { |
||
201 | $data['captcha_required'] = $this->dx_auth->captcha_registration; |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
$data was never initialized. Although not strictly required by PHP, it is generally a good practice to add $data = array(); before regardless.
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code. Let’s take a look at an example: foreach ($collection as $item) {
$myArray['foo'] = $item->getFoo();
if ($item->hasBar()) {
$myArray['bar'] = $item->getBar();
}
// do something with $myArray
}
As you can see in this example, the array This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop. ![]() |
|||
202 | $data['captcha_image'] = $this->dx_auth->get_captcha_image(); |
||
203 | } |
||
204 | $json['msg'] = validation_errors(); |
||
205 | $json['validations'] = [ |
||
206 | 'email' => form_error('email'), |
||
207 | 'username' => form_error('username'), |
||
208 | 'password' => form_error('password'), |
||
209 | 'confirm_password' => form_error('confirm_password'), |
||
210 | 'captcha' => form_error('captcha'), |
||
211 | 'recaptcha_response_field' => form_error('recaptcha_response_field'), |
||
212 | ]; |
||
213 | $json['status'] = false; |
||
214 | $json['anotherone'] = false; |
||
215 | echo json_encode($json); |
||
216 | } |
||
217 | } elseif (!$this->dx_auth->allow_registration) { |
||
218 | $json = []; |
||
219 | //$json['additional_info']['allow_registration'] = false; |
||
220 | $json['msg'] = lang('Registration is not allowed', 'auth'); |
||
221 | $json['status'] = false; |
||
222 | echo json_encode($json); |
||
223 | } else { |
||
224 | $json = []; |
||
225 | $json['msg'] = lang('User is logged in', 'auth'); |
||
226 | $json['status'] = false; |
||
227 | echo json_encode($json); |
||
228 | } |
||
229 | } |
||
230 | |||
231 | /** |
||
232 | * Provides sending forgotten password to user email |
||
233 | * |
||
234 | * require: |
||
235 | |||
236 | */ |
||
237 | public function forgot_password() { |
||
238 | $val = $this->form_validation; |
||
239 | // Set form validation rules |
||
240 | $this->form_validation->set_message('required', lang('The %s is required', 'auth')); |
||
241 | |||
242 | $val->set_rules('email', lang('Email', 'auth'), 'trim|required|xss_clean|valid_email|callback_email_check_for_login'); |
||
243 | |||
244 | //clear user newpass_time |
||
245 | $this->db |
||
246 | ->where('email', $this->input->post('email')) |
||
247 | ->update('users', ['newpass_time' => null]); |
||
248 | |||
249 | // Validate rules and call forgot password function |
||
250 | if ($val->run($this) AND $this->dx_auth->forgot_password($val->set_value('email'))) { |
||
251 | echo json_encode( |
||
252 | [ |
||
253 | 'msg' => lang('Email with new password send to you email', 'auth'), |
||
254 | 'status' => true, |
||
255 | ] |
||
256 | ); |
||
257 | } else { |
||
258 | if ($this->dx_auth->_auth_error) { |
||
259 | $error = $this->dx_auth->_auth_error; |
||
260 | } else { |
||
261 | $error = form_error('email'); |
||
262 | } |
||
263 | echo json_encode( |
||
264 | [ |
||
265 | 'msg' => validation_errors(), |
||
266 | 'validations' => ['email' => $error], |
||
267 | 'status' => false, |
||
268 | ] |
||
269 | ); |
||
270 | } |
||
271 | } |
||
272 | |||
273 | /** |
||
274 | * Provides password reset |
||
275 | * |
||
276 | * require: |
||
277 | |||
278 | */ |
||
279 | public function reset_password() { |
||
280 | // Get username and key |
||
281 | $email = $this->input->post('email'); |
||
282 | $key = $this->input->post('key'); |
||
283 | // Reset password |
||
284 | if ($this->dx_auth->is_logged_in()) { |
||
285 | if ($this->dx_auth->reset_password($email, $key)) { |
||
286 | echo json_encode( |
||
287 | [ |
||
288 | 'msg' => lang('You have successfully zeroed my password. ', 'auth') . anchor(site_url($this->dx_auth->login_uri), lang('Login Here', 'auth')), |
||
289 | 'status' => true, |
||
290 | ] |
||
291 | ); |
||
292 | } else { |
||
293 | echo json_encode( |
||
294 | [ |
||
295 | 'msg' => lang('Reset password failed', 'auth'), |
||
296 | 'status' => false, |
||
297 | ] |
||
298 | ); |
||
299 | } |
||
300 | } else { |
||
301 | echo json_encode( |
||
302 | [ |
||
303 | 'msg' => lang('You have to be logged in to reset password', 'auth'), |
||
304 | 'status' => false, |
||
305 | ] |
||
306 | ); |
||
307 | } |
||
308 | } |
||
309 | |||
310 | /** |
||
311 | * Provides password change |
||
312 | * @return string |
||
313 | * @access public |
||
314 | * @copyright ImageCMS (c) 2013 |
||
315 | */ |
||
316 | public function change_password() { |
||
317 | /** Preprate Variables */ |
||
318 | $jsonResponse = []; |
||
319 | |||
320 | /** Check if user logged in or not */ |
||
321 | if ($this->dx_auth->is_logged_in()) { |
||
322 | |||
323 | /** Set form validation */ |
||
324 | $this->form_validation->set_rules('old_password', lang('Old password', 'auth'), 'trim|required|xss_clean|min_length[' . $this->min_password . ']|max_length[' . $this->max_password . ']'); |
||
325 | $this->form_validation->set_rules('new_password', lang('New password', 'auth'), 'trim|required|xss_clean|min_length[' . $this->min_password . ']|max_length[' . $this->max_password . ']|matches[confirm_new_password]'); |
||
326 | $this->form_validation->set_rules('confirm_new_password', lang('Confirm password', 'auth'), 'trim|required|xss_clean'); |
||
327 | |||
328 | /** Validate rules and change password */ |
||
329 | $validationResult = $this->form_validation->run(); |
||
330 | $changePasswordResult = $this->dx_auth->change_password($this->input->post('old_password'), $this->input->post('new_password')); |
||
331 | |||
332 | /** Prepare response */ |
||
333 | if (TRUE === $validationResult AND TRUE === $changePasswordResult) { |
||
334 | $jsonResponse['msg'] = lang('Your password was successfully changed.', 'auth'); |
||
335 | $jsonResponse['status'] = TRUE; |
||
336 | } else { |
||
337 | $validationErrors = validation_errors(); |
||
338 | if (!empty($validationErrors)) { |
||
339 | $jsonResponse['msg'] = $validationErrors; |
||
340 | $jsonResponse['validations'] = [ |
||
341 | 'old_password' => form_error('old_password'), |
||
342 | 'new_password' => form_error('new_password'), |
||
343 | 'confirm_new_password' => form_error('confirm_new_password'), |
||
344 | ]; |
||
345 | $jsonResponse['status'] = false; |
||
346 | } else { |
||
347 | $jsonResponse['validations'] = ['old_password' => lang('Field Old password is not correct', 'auth')]; |
||
348 | $jsonResponse['status'] = FALSE; |
||
349 | } |
||
350 | } |
||
351 | } else { |
||
352 | $jsonResponse['msg'] = lang('You are not logged in to change password', 'auth'); |
||
353 | $jsonResponse['status'] = false; |
||
354 | } |
||
355 | $jsonResponse['refresh'] = false; |
||
356 | $jsonResponse['redirect'] = false; |
||
357 | |||
358 | /** return JSON Data */ |
||
359 | return json_encode($jsonResponse); |
||
360 | } |
||
361 | |||
362 | View Code Duplication | public function email_check($email) { |
|
363 | |||
364 | $result = $this->dx_auth->is_email_available($email); |
||
365 | if (!$result) { |
||
366 | $this->form_validation->set_message('email_check', lang('A user with this email is already registered.', 'auth')); |
||
367 | } |
||
368 | |||
369 | return $result; |
||
370 | } |
||
371 | |||
372 | /** |
||
373 | * Provides cancelling account if user is logged in |
||
374 | */ |
||
375 | public function cancel_account() { |
||
376 | // Check if user logged in or not |
||
377 | if ($this->dx_auth->is_logged_in()) { |
||
378 | $val = $this->form_validation; |
||
379 | // Set form validation rules |
||
380 | $val->set_rules('password', lang('Password', 'auth'), 'trim|required|xss_clean'); |
||
381 | // Validate rules and change password |
||
382 | if ($val->run($this) AND $this->dx_auth->cancel_account($val->set_value('password'))) { |
||
383 | echo json_encode( |
||
384 | [ |
||
385 | 'msg' => lang('Deleting account completed', 'auth'), |
||
386 | 'status' => true, |
||
387 | ] |
||
388 | ); |
||
389 | } else { |
||
390 | echo json_encode( |
||
391 | [ |
||
392 | 'msg' => validation_errors(), |
||
393 | 'validations' => [ |
||
394 | 'password' => form_error('password'), |
||
395 | ], |
||
396 | 'status' => false, |
||
397 | ] |
||
398 | ); |
||
399 | } |
||
400 | } else { |
||
401 | echo json_encode( |
||
402 | [ |
||
403 | 'msg' => lang('You are not logged in, you dont have any account to delete', 'auth'), |
||
404 | 'status' => false, |
||
405 | ] |
||
406 | ); |
||
407 | } |
||
408 | } |
||
409 | |||
410 | /** |
||
411 | * Returns ban reason if user is banned |
||
412 | */ |
||
413 | public function banned() { |
||
414 | echo json_encode( |
||
415 | [ |
||
416 | 'msg' => lang('Your account has been blocked.', 'auth') . $this->ban_reason, |
||
417 | 'status' => false, |
||
418 | 'refresh' => true, |
||
419 | 'redirect' => false, |
||
420 | ] |
||
421 | ); |
||
422 | } |
||
423 | |||
424 | /** |
||
425 | * Check if user logined |
||
426 | */ |
||
427 | public function is_logined() { |
||
428 | if ($this->dx_auth->is_logged_in()) { |
||
429 | echo json_encode( |
||
430 | [ |
||
431 | 'msg' => lang('User is already login in', 'auth'), |
||
432 | 'status' => true, |
||
433 | ] |
||
434 | ); |
||
435 | } else { |
||
436 | echo json_encode( |
||
437 | [ |
||
438 | 'msg' => lang('User not logined', 'auth'), |
||
439 | 'status' => false, |
||
440 | ] |
||
441 | ); |
||
442 | } |
||
443 | } |
||
444 | |||
445 | /** |
||
446 | * Callback for Form Validation Class |
||
447 | * @return bool |
||
448 | * @access public |
||
449 | * @copyright ImageCMS (c) 2013 |
||
450 | */ |
||
451 | public function email_check_for_login($email) { |
||
452 | $result = $this->dx_auth->is_email_available($email); |
||
453 | if ($result) { |
||
454 | $this->form_validation->set_message('email_check_for_login', lang('A user with such mail is not found in the database', 'auth')); |
||
455 | return false; |
||
456 | } else { |
||
457 | return true; |
||
458 | } |
||
459 | } |
||
460 | |||
461 | /** |
||
462 | * Class init Method |
||
463 | */ |
||
464 | private function initialize() { |
||
465 | $this->load->library('form_validation'); |
||
466 | $this->form_validation->set_error_delimiters(false, false); |
||
467 | $this->load->language('auth'); |
||
468 | $this->load->module('auth'); |
||
469 | $this->min_username = $this->auth->min_username; |
||
470 | $this->max_username = $this->auth->max_username; |
||
471 | $this->max_password = $this->auth->max_password; |
||
472 | $this->min_password = $this->auth->min_password; |
||
473 | } |
||
474 | |||
475 | /** |
||
476 | * captcha check |
||
477 | * @param string $code |
||
478 | * @return boolean |
||
479 | */ |
||
480 | public function captcha_check($code) { |
||
481 | if (!$this->dx_auth->captcha_check($code)) { |
||
0 ignored issues
–
show
|
|||
482 | return FALSE; |
||
483 | } else { |
||
484 | return TRUE; |
||
485 | } |
||
486 | } |
||
487 | |||
488 | } |
||
489 | |||
490 | /* End of file authapi.php */ |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.