diff --git a/src/lib/models/customers.php b/src/lib/models/customers.php index df80e69..8452233 100644 --- a/src/lib/models/customers.php +++ b/src/lib/models/customers.php @@ -427,17 +427,15 @@ class customers extends \db public function resetPasswd( $registration ) { $connection = $this->database; -// -// try -// { + + try + { $connection->begin(); $data_customer_id = $this->get( ' SELECT - customer_id, - users_group_id, - special_users_id + customer_id FROM public.customers_confirm WHERE @@ -450,7 +448,7 @@ class customers extends \db ], -1 ); - die('here1'); + if( !empty( $data_customer_id ) ) { @@ -488,11 +486,31 @@ class customers extends \db ] ); + + $data = $this->get( + ' + SELECT + id, + status, + users_group_id, + special_users_id + FROM + public.customers + WHERE + id = :customer_id + LIMIT + 1 + ', + [ + 'customer_id' => $data_customer_id['0']['customer_id'], + ], + -1 + ); + $this->getDi()->get('session')->set( 'isAuth', true ); $this->getDi()->get('session')->set( 'id', $data_customer_id['0']['customer_id'] ); - $this->getDi()->get('session')->set( 'users_group_id', $data_customer_id['0']['users_group_id'] ); - $this->getDi()->get('session')->set( 'special_users_id', $data_customer_id['0']['special_users_id'] ); - + $this->getDi()->get('session')->set( 'users_group_id', $data['0']['users_group_id'] ); + $this->getDi()->get('session')->set( 'special_users_id', $data['0']['special_users_id'] ); $result = 1; @@ -505,11 +523,11 @@ class customers extends \db $connection->commit(); return $result; -// } -// catch(\Exception $e) -// { -// $connection->rollback(); -// } + } + catch(\Exception $e) + { + $connection->rollback(); + } return false; } -- libgit2 0.21.4