api/webservice/WebserviceStandard/Users/ChangePassword.php
Avoid using static access to class '\App\Encryption' in method 'put'. Open
Open
'password' => \App\Encryption::createPasswordHash($this->controller->request->getRaw('newPassword'), $this->controller->app['type']),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Encryption' in method 'put'. Open
Open
if (\App\Encryption::verifyPasswordHash($this->controller->request->getRaw('currentPassword'), $this->getUserData('password'), $this->controller->app['type'])) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Possibly zero references to use statement for classlike/namespace OA
(\OpenApi\Annotations)
Open
Open
use OpenApi\Annotations as OA;
- Exclude checks
Call to method createPasswordHash
from undeclared class \App\Encryption
(Did you mean class \Tests\App\Encryption) Open
Open
'password' => \App\Encryption::createPasswordHash($this->controller->request->getRaw('newPassword'), $this->controller->app['type']),
- Exclude checks
Call to method verifyPasswordHash
from undeclared class \App\Encryption
(Did you mean class \Tests\App\Encryption) Open
Open
if (\App\Encryption::verifyPasswordHash($this->controller->request->getRaw('currentPassword'), $this->getUserData('password'), $this->controller->app['type'])) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* required=true,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Parameter(name="X-ENCRYPTED", in="header", @OA\Schema(ref="#/components/schemas/Header-Encrypted"), required=true),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Schema(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* type="object",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* type="object",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* mediaType="multipart/form-data",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* title="New password",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* title="Users module - Users password change response body",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* summary="User password change",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\JsonContent(ref="#/components/schemas/Users_Put_ChangePassword_Request"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\JsonContent(ref="#/components/schemas/Users_Put_ChangePassword_Request"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Schema(ref="#/components/schemas/Users_Put_ChangePassword_Request")
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Schema(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Response(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\XmlContent(ref="#/components/schemas/Users_Put_ChangePassword_Response"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* property="currentPassword",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* type="string"
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* schema="Users_Put_ChangePassword_Response",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* required={"status", "result"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* summary="User password change",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Schema(ref="#/components/schemas/Users_Put_ChangePassword_Request")
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\XmlContent(ref="#/components/schemas/Users_Put_ChangePassword_Response"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* required={"currentPassword", "newPassword"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* type="string",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* description="Input data",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\MediaType(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* schema="Users_Put_ChangePassword_Request",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* tags={"Users"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Property(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* type="object",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* description="User password change",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\MediaType(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* required={"currentPassword", "newPassword"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Schema(ref="#/components/schemas/Users_Put_ChangePassword_Request")
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* response=200,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* description="Response",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* property="newPassword",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* type="string"
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Schema(ref="#/components/schemas/Users_Put_ChangePassword_Request")
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* property="currentPassword",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Property(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* path="/webservice/WebserviceStandard/Users/ChangePassword",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\RequestBody(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\RequestBody(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* mediaType="application/x-www-form-urlencoded",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\JsonContent(ref="#/components/schemas/Users_Put_ChangePassword_Response"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Property(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* property="newPassword",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Schema(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\MediaType(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Parameter(name="X-ENCRYPTED", in="header", @OA\Schema(ref="#/components/schemas/Header-Encrypted"), required=true),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* response=200,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* schema="Users_Put_ChangePassword_Request",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* title="Current password",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* schema="Users_Put_ChangePassword_Response",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* tags={"Users"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* security={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* security={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* required=true,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* description="Response",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* title="Users module - Users password change request body",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* title="Users module - Users password change response body",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* mediaType="application/x-www-form-urlencoded",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* title="Users module - Users password change request body",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* title="Current password",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* type="string",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* required={"status", "result"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
]);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
public function put(): bool
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* description="User password change",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* description="Input data",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\MediaType(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Response(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* type="object",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* title="New password",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
]);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Property(property="result", type="boolean", description="Password change status", example=false),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
'status' => 'LBL_FAILED_PASSWORD_CHANGED',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
return false;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
'password' => \App\Encryption::createPasswordHash($this->controller->request->getRaw('newPassword'), $this->controller->app['type']),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
return true;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* mediaType="multipart/form-data",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\JsonContent(ref="#/components/schemas/Users_Put_ChangePassword_Response"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Property(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
if (\App\Encryption::verifyPasswordHash($this->controller->request->getRaw('currentPassword'), $this->getUserData('password'), $this->controller->app['type'])) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Property(property="status", type="integer", enum={0, 1}, description="A numeric value of 0 or 1 that indicates whether the communication is valid. 1 - success , 0 - error"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Property(property="result", type="boolean", description="Password change status", example=false),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
$this->updateUser([
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
'status' => 'LBL_PASSWORD_CHANGED',
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
$this->saveLoginHistory([
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
$this->saveLoginHistory([
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
]);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @OA\Property(property="status", type="integer", enum={0, 1}, description="A numeric value of 0 or 1 that indicates whether the communication is valid. 1 - success , 0 - error"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @OA\Put(
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Put method.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* path="/webservice/WebserviceStandard/Users/ChangePassword",
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
Open
* @OA\Parameter(name="X-ENCRYPTED", in="header", @OA\Schema(ref="#/components/schemas/Header-Encrypted"), required=true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public $allowedMethod = ['PUT'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected function checkPermissionToModule(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
use \Api\Core\Traits\LoginHistory;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @api
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Line exceeds 120 characters; contains 189 characters Open
Open
* @OA\Property(property="status", type="integer", enum={0, 1}, description="A numeric value of 0 or 1 that indicates whether the communication is valid. 1 - success , 0 - error"),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** {@inheritdoc} */
- Exclude checks
Line exceeds 120 characters; contains 149 characters Open
Open
'password' => \App\Encryption::createPasswordHash($this->controller->request->getRaw('newPassword'), $this->controller->app['type']),
- Exclude checks
Line exceeds 120 characters; contains 169 characters Open
Open
if (\App\Encryption::verifyPasswordHash($this->controller->request->getRaw('currentPassword'), $this->getUserData('password'), $this->controller->app['type'])) {
- Exclude checks