// Import framework stuff
use Org\Mxchange\CoreFramework\Filter\BaseFilter;
+use Org\Mxchange\CoreFramework\Filter\Chain\FilterChainException;
use Org\Mxchange\CoreFramework\Filter\Filterable;
-use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
+use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
+use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry;
use Org\Mxchange\CoreFramework\Request\Requestable;
use Org\Mxchange\CoreFramework\Response\Responseable;
*
* @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.shipsimu.org
*
*
* @return void
*/
- protected function __construct () {
+ private function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
}
/**
* Creates an instance of this filter class
*
- * @param $controllerInstance An instance of a controller class
- * @return $filterInstance An instance of this filter class
+ * @return $filterInstance An instance of this filter class
*/
- public static final function createPasswordChangeFilter () {
+ public static final function createPasswordChangeFilter (): Filterable {
// Get a new instance
$filterInstance = new PasswordChangeFilter();
* @todo Finished updating user password hash here. HINT: Use the User class again.
* @throws FilterChainException If this filter fails to operate
*/
- public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ public function execute (Requestable $requestInstance, Responseable $responseInstance): void {
// Get both passwords
$pass1 = $requestInstance->getRequestElement('pass1');
$pass2 = $requestInstance->getRequestElement('pass2');
// Is only first email set?
if ((!empty($pass1)) && (empty($pass2))) {
// Request is invalid!
- $requestInstance->requestIsValid(false);
+ $requestInstance->setIsRequestValid(FALSE);
// Email 2 is empty
$responseInstance->addFatalMessage('pass2_empty');
// Stop processing here
throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
- } // END - if
+ }
// Is only second pass set?
if ((empty($pass1)) && (!empty($pass2))) {
// Request is invalid!
- $requestInstance->requestIsValid(false);
+ $requestInstance->setIsRequestValid(FALSE);
// Email 1 is empty
$responseInstance->addFatalMessage('pass1_empty');
// Stop processing here
throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
- } // END - if
+ }
// Are password and confirmation empty?
if ((empty($pass1)) && (empty($pass2))) {
// Don't change password here
- return true;
- } // END - if
+ return;
+ }
// Do both match?
if ($pass1 != $pass2) {
// Request is invalid!
- $requestInstance->requestIsValid(false);
+ $requestInstance->setIsRequestValid(FALSE);
// Emails are mismatching
$responseInstance->addFatalMessage('pass_mismatch');
// Stop processing here
throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
- } // END - if
+ }
// Now, get a user instance for comparison
- $userInstance = GenericRegistry::getRegistry()->getInstance('user');
+ $userInstance = ObjectRegistry::getRegistry('generic')->getInstance('user');
// Update the "password" field
- $this->partialStub('Unfinished part.');
+ DebugMiddleware::getSelfInstance()->partialStub('Unfinished part.');
}
}