-
mentioned in commit f7901d1b164a90fd4cee865a96f7ccf01a1622d2
-
Status changed to merged
Showing
2 changed files
Show diff stats
src/app/frontend/controllers/CustomerController.php
@@ -405,6 +405,7 @@ class CustomerController extends \controllers\ControllerBase | @@ -405,6 +405,7 @@ class CustomerController extends \controllers\ControllerBase | ||
405 | if( $passwd === $confirm_passwd ) | 405 | if( $passwd === $confirm_passwd ) |
406 | { | 406 | { |
407 | $registration['passwd'] = $this->common->hashPasswd( $passwd ); | 407 | $registration['passwd'] = $this->common->hashPasswd( $passwd ); |
408 | + $registration['user_pass'] = $passwd; | ||
408 | $registration['confirm_key'] = $confirm_key; | 409 | $registration['confirm_key'] = $confirm_key; |
409 | 410 | ||
410 | switch( $this->models->getCustomers()->resetPasswd( $registration ) ) | 411 | switch( $this->models->getCustomers()->resetPasswd( $registration ) ) |
@@ -413,7 +414,10 @@ class CustomerController extends \controllers\ControllerBase | @@ -413,7 +414,10 @@ class CustomerController extends \controllers\ControllerBase | ||
413 | // OK | 414 | // OK |
414 | // redirect | 415 | // redirect |
415 | $this->flash->success($this->languages->getTranslation()->_("successfully_edited_your_password")); | 416 | $this->flash->success($this->languages->getTranslation()->_("successfully_edited_your_password")); |
416 | - return $this->response->redirect([ 'for' => 'cabinet', 'language' => $this->lang_name ]); | 417 | + if($this->session->get('special_users_id') != null) { |
418 | + return $this->response->redirect(['for' => 'personal_data', 'language' => $this->lang_name]); | ||
419 | + } | ||
420 | + return $this->response->redirect(['for' => 'cabinet', 'language' => $this->lang_name]); | ||
417 | break; | 421 | break; |
418 | 422 | ||
419 | case 0: | 423 | case 0: |
src/lib/models/customers.php
@@ -486,9 +486,31 @@ class customers extends \db | @@ -486,9 +486,31 @@ class customers extends \db | ||
486 | ] | 486 | ] |
487 | ); | 487 | ); |
488 | 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 | + | ||
489 | $this->getDi()->get('session')->set( 'isAuth', true ); | 510 | $this->getDi()->get('session')->set( 'isAuth', true ); |
490 | $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'] ); |
491 | - | 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'] ); | ||
492 | 514 | ||
493 | $result = 1; | 515 | $result = 1; |
494 | 516 | ||
@@ -500,7 +522,7 @@ class customers extends \db | @@ -500,7 +522,7 @@ class customers extends \db | ||
500 | 522 | ||
501 | $connection->commit(); | 523 | $connection->commit(); |
502 | 524 | ||
503 | - return true; | 525 | + return $result; |
504 | } | 526 | } |
505 | catch(\Exception $e) | 527 | catch(\Exception $e) |
506 | { | 528 | { |