Commit e010e1df6ff7e399ee1eee594be618e06b4173c5
1 parent
b8aeff9c
add local config
Showing
1 changed file
with
33 additions
and
15 deletions
Show diff stats
src/lib/models/customers.php
@@ -427,17 +427,15 @@ class customers extends \db | @@ -427,17 +427,15 @@ class customers extends \db | ||
427 | public function resetPasswd( $registration ) | 427 | public function resetPasswd( $registration ) |
428 | { | 428 | { |
429 | $connection = $this->database; | 429 | $connection = $this->database; |
430 | -// | ||
431 | -// try | ||
432 | -// { | 430 | + |
431 | + try | ||
432 | + { | ||
433 | $connection->begin(); | 433 | $connection->begin(); |
434 | 434 | ||
435 | $data_customer_id = $this->get( | 435 | $data_customer_id = $this->get( |
436 | ' | 436 | ' |
437 | SELECT | 437 | SELECT |
438 | - customer_id, | ||
439 | - users_group_id, | ||
440 | - special_users_id | 438 | + customer_id |
441 | FROM | 439 | FROM |
442 | public.customers_confirm | 440 | public.customers_confirm |
443 | WHERE | 441 | WHERE |
@@ -450,7 +448,7 @@ class customers extends \db | @@ -450,7 +448,7 @@ class customers extends \db | ||
450 | ], | 448 | ], |
451 | -1 | 449 | -1 |
452 | ); | 450 | ); |
453 | - die('here1'); | 451 | + |
454 | if( !empty( $data_customer_id ) ) | 452 | if( !empty( $data_customer_id ) ) |
455 | { | 453 | { |
456 | 454 | ||
@@ -488,11 +486,31 @@ class customers extends \db | @@ -488,11 +486,31 @@ class customers extends \db | ||
488 | ] | 486 | ] |
489 | ); | 487 | ); |
490 | 488 | ||
489 | + | ||
490 | + $data = $this->get( | ||
491 | + ' | ||
492 | + SELECT | ||
493 | + id, | ||
494 | + status, | ||
495 | + users_group_id, | ||
496 | + special_users_id | ||
497 | + FROM | ||
498 | + public.customers | ||
499 | + WHERE | ||
500 | + id = :customer_id | ||
501 | + LIMIT | ||
502 | + 1 | ||
503 | + ', | ||
504 | + [ | ||
505 | + 'customer_id' => $data_customer_id['0']['customer_id'], | ||
506 | + ], | ||
507 | + -1 | ||
508 | + ); | ||
509 | + | ||
491 | $this->getDi()->get('session')->set( 'isAuth', true ); | 510 | $this->getDi()->get('session')->set( 'isAuth', true ); |
492 | $this->getDi()->get('session')->set( 'id', $data_customer_id['0']['customer_id'] ); | 511 | $this->getDi()->get('session')->set( 'id', $data_customer_id['0']['customer_id'] ); |
493 | - $this->getDi()->get('session')->set( 'users_group_id', $data_customer_id['0']['users_group_id'] ); | ||
494 | - $this->getDi()->get('session')->set( 'special_users_id', $data_customer_id['0']['special_users_id'] ); | ||
495 | - | 512 | + $this->getDi()->get('session')->set( 'users_group_id', $data['0']['users_group_id'] ); |
513 | + $this->getDi()->get('session')->set( 'special_users_id', $data['0']['special_users_id'] ); | ||
496 | 514 | ||
497 | $result = 1; | 515 | $result = 1; |
498 | 516 | ||
@@ -505,11 +523,11 @@ class customers extends \db | @@ -505,11 +523,11 @@ class customers extends \db | ||
505 | $connection->commit(); | 523 | $connection->commit(); |
506 | 524 | ||
507 | return $result; | 525 | return $result; |
508 | -// } | ||
509 | -// catch(\Exception $e) | ||
510 | -// { | ||
511 | -// $connection->rollback(); | ||
512 | -// } | 526 | + } |
527 | + catch(\Exception $e) | ||
528 | + { | ||
529 | + $connection->rollback(); | ||
530 | + } | ||
513 | 531 | ||
514 | return false; | 532 | return false; |
515 | } | 533 | } |