YetiForceCompany/YetiForceCRM

View on GitHub
api/webservice/WebserviceStandard/Users/ResetPassword.php

Summary

Maintainability
A
1 hr
Test Coverage
B
84%

Method post has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function post(): array
    {
        $db = \App\Db::getInstance('webservice');
        $userData = (new \App\Db\Query())->from($this->controller->app['tables']['user'])
            ->where(['user_name' => $this->controller->request->get('userName'), 'status' => 1])
Severity: Minor
Found in api/webservice/WebserviceStandard/Users/ResetPassword.php - About 1 hr to fix

    Missing class import via use statement (line '103', column '20').
    Open

            $userData = (new \App\Db\Query())->from($this->controller->app['tables']['user'])

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '218', column '20').
    Open

            $userData = (new \App\Db\Query())->from($this->controller->app['tables']['user'])->where(['id' => $tokenData['params'][0], 'status' => 1])

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '215', column '14').
    Open

                throw new \App\Exceptions\Security('ERR_TOKEN_DOES_NOT_EXIST', 405);

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '110', column '14').
    Open

                throw new \Api\Core\Exception(\App\Language::translate('LBL_USER_MAIL_NOT_EXIST', 'Users'), 404);

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '224', column '14').
    Open

                throw new \App\Exceptions\Security(\App\Language::translate('LBL_USER_MAIL_NOT_EXIST', 'Users'), 404);

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Avoid using static access to class '\App\Language' in method 'post'.
    Open

                throw new \Api\Core\Exception(\App\Language::translate('LBL_USER_MAIL_NOT_EXIST', 'Users'), 404);

    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\Utils\Tokens' in method 'post'.
    Open

            $token = \App\Utils\Tokens::generate('\Api\WebserviceStandard\Users\ResetPassword', [$id], $expirationDate);

    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\User' in method 'post'.
    Open

            \App\User::setCurrentUserId($userData['user_id']);

    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\Utils\Tokens' in method 'put'.
    Open

            $tokenData = \App\Utils\Tokens::get($token);

    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\Mailer' in method 'post'.
    Open

            $status = \App\Mailer::sendFromTemplate([
                'template' => 'UsersResetPassword',
                'to' => $userData['user_name'],
                'siteUrl' => $this->controller->app['url'] ?: '',
                'url' => $this->controller->app['url'] ? ($this->controller->app['url'] . 'index.php?module=Users&view=LoginPassReset&mode=token&token=' . $token) : '',

    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\Db' in method 'post'.
    Open

            $db = \App\Db::getInstance('webservice');

    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\Db' in method 'put'.
    Open

            $db = \App\Db::getInstance('webservice');

    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

                'password' => \App\Encryption::createPasswordHash($this->controller->request->getRaw('password'), $this->controller->app['type']),

    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

    The method post uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $this->saveLoginHistory([
                    'status' => 'ERR_RESET_PASSWORD_REQUEST_SMTP_ERROR',
                ]);
            }

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    Avoid using static access to class '\App\Language' in method 'put'.
    Open

                throw new \App\Exceptions\Security(\App\Language::translate('LBL_USER_MAIL_NOT_EXIST', 'Users'), 404);

    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

    Define a constant instead of duplicating this literal "status" 7 times.
    Open

                ->where(['user_name' => $this->controller->request->get('userName'), 'status' => 1])

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Possibly zero references to use statement for classlike/namespace OA (\OpenApi\Annotations)
    Open

    use OpenApi\Annotations as OA;

    Call to undeclared method \App\Db\Query::from
    Open

            $userData = (new \App\Db\Query())->from($this->controller->app['tables']['user'])

    Doc-block of post contains declared return type bool which is incompatible with the return type array declared in the signature
    Open

         * @return bool

    Call to method setCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
    Open

            \App\User::setCurrentUserId($userData['user_id']);

    Call to undeclared method \App\Db\Query::from
    Open

            $userData = (new \App\Db\Query())->from($this->controller->app['tables']['user'])->where(['id' => $tokenData['params'][0], 'status' => 1])

    Call to method createPasswordHash from undeclared class \App\Encryption (Did you mean class \Tests\App\Encryption)
    Open

                'password' => \App\Encryption::createPasswordHash($this->controller->request->getRaw('password'), $this->controller->app['type']),

    Avoid variables with short names like $db. Configured minimum length is 3.
    Open

            $db = \App\Db::getInstance('webservice');

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

    Avoid variables with short names like $id. Configured minimum length is 3.
    Open

            $id = (int) $userData['id'];

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

    Avoid variables with short names like $db. Configured minimum length is 3.
    Open

            $db = \App\Db::getInstance('webservice');

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    @OA\Post(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *          required=true,

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             @OA\MediaType(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\JsonContent(ref="#/components/schemas/Users_Post_ResetPassword_Response"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\JsonContent(ref="#/components/schemas/Users_Post_ResetPassword_Response"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    @OA\Schema(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        security={

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            description="User with this email address does not exist",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        required={"userName"},

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            {"basicAuth" : {}, "ApiKeyAuth" : {}}

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\JsonContent(ref="#/components/schemas/Users_Post_ResetPassword_Request"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            response=200,

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\JsonContent(ref="#/components/schemas/Exception"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        summary="User password reset-Generatingandsendingaone-timetoken",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\RequestBody(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             @OA\MediaType(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *                 @OA\Schema(ref="#/components/schemas/Users_Post_ResetPassword_Request")

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Parameter(name="X-ENCRYPTED", in="header", @OA\Schema(ref="#/components/schemas/Header-Encrypted"), required=true),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             @OA\MediaType(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *                 mediaType="multipart/form-data",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *                 mediaType="multipart/form-data",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *         title="Users module - Users password reset request body",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            {"basicAuth" : {}, "ApiKeyAuth" : {}}

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\RequestBody(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *          description="Input data",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *                 mediaType="application/x-www-form-urlencoded",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    @OA\Schema(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        description="User password reset - Generating and sending a one-time token",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        tags={"Users"},

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        security={

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        },

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Response(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            response=404,

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *                 @OA\Schema(ref="#/components/schemas/Users_Post_ResetPassword_Request")

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Response(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Response(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        type="object",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        required={"userName"},

    Spaces must be used for alignment; tabs are not allowed
    Open

         *          description="Input data",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *                 @OA\Schema(ref="#/components/schemas/Users_Post_ResetPassword_Request")

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            description="Response",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            description="Response",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            description="User with this email address does not exist",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *         schema="Users_Post_ResetPassword_Request",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *         schema="Users_Post_ResetPassword_Request",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        summary="User password reset-Generatingandsendingaone-timetoken",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *                 @OA\Schema(ref="#/components/schemas/Users_Post_ResetPassword_Request")

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\XmlContent(ref="#/components/schemas/Exception"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        type="object",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        path="/webservice/WebserviceStandard/Users/ResetPassword",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        description="User password reset - Generating and sending a one-time token",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        tags={"Users"},

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        },

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            response=200,

    Spaces must be used for alignment; tabs are not allowed
    Open

         *              title="Content of responses from a given method",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\Property(property="expirationDate", type="string", example="2019-10-07 08:32:38"),

    Spaces must be used for alignment; tabs are not allowed
    Open

            $db = \App\Db::getInstance('webservice');

    Spaces must be used for alignment; tabs are not allowed
    Open

            $token = \App\Utils\Tokens::generate('\Api\WebserviceStandard\Users\ResetPassword', [$id], $expirationDate);

    Spaces must be used for alignment; tabs are not allowed
    Open

                'siteUrl' => $this->controller->app['url'] ?: '',

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        path="/webservice/WebserviceStandard/Users/ResetPassword",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        tags={"Users"},

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\JsonContent(ref="#/components/schemas/Users_Put_ResetPassword_Request"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *                 mediaType="application/x-www-form-urlencoded",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            response=200,

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             @OA\MediaType(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *                 mediaType="application/x-www-form-urlencoded",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\XmlContent(ref="#/components/schemas/Users_Post_ResetPassword_Response"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        type="object",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        required={"status", "result"},

    Spaces must be used for alignment; tabs are not allowed
    Open

         *

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        description="User password reset - Password change",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *          description="Input data",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *                 mediaType="multipart/form-data",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            response=200,

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Response(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            response=404,

    Spaces must be used for alignment; tabs are not allowed
    Open

                    'status' => 'LBL_RESET_PASSWORD_REQUEST',

    Spaces must be used for alignment; tabs are not allowed
    Open

            }

    Spaces must be used for alignment; tabs are not allowed
    Open

         * Put method.

    Spaces must be used for alignment; tabs are not allowed
    Open

         * @api

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Parameter(name="X-ENCRYPTED", in="header", @OA\Schema(ref="#/components/schemas/Header-Encrypted"), required=true),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\JsonContent(ref="#/components/schemas/Exception"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *         title="Users module - Users password reset request body",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *      @OA\Property(property="userName", type="string", description="User name / email"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *      @OA\Property(property="userName", type="string", description="User name / email"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *              title="Content of responses from a given method",

    Spaces must be used for alignment; tabs are not allowed
    Open

                'token' => $token,

    Spaces must be used for alignment; tabs are not allowed
    Open

                ]);

    Spaces must be used for alignment; tabs are not allowed
    Open

                    'status' => 'ERR_RESET_PASSWORD_REQUEST_SMTP_ERROR',

    Spaces must be used for alignment; tabs are not allowed
    Open

            ];

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\RequestBody(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *          required=true,

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             @OA\MediaType(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Response(

    Spaces must be used for alignment; tabs are not allowed
    Open

            $status = \App\Mailer::sendFromTemplate([

    Spaces must be used for alignment; tabs are not allowed
    Open

                'mailerStatus' => $status,

    Spaces must be used for alignment; tabs are not allowed
    Open

         * @return bool

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\JsonContent(ref="#/components/schemas/Users_Put_ResetPassword_Request"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Response(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        path="/webservice/WebserviceStandard/Users/ResetPassword",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *          required=true,

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\JsonContent(ref="#/components/schemas/Users_Post_ResetPassword_Request"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Parameter(name="X-ENCRYPTED", in="header", @OA\Schema(ref="#/components/schemas/Header-Encrypted"), required=true),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\XmlContent(ref="#/components/schemas/Users_Post_ResetPassword_Response"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Response(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\XmlContent(ref="#/components/schemas/Exception"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *         title="Users module - Users password reset response body",

    Spaces must be used for alignment; tabs are not allowed
    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"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Property(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Property(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\Property(property="expirationDate", type="string", example="2019-10-07 08:32:38"),

    Spaces must be used for alignment; tabs are not allowed
    Open

                $this->saveLoginHistory([

    Spaces must be used for alignment; tabs are not allowed
    Open

                    'status' => 'ERR_EMAIL_NOT_FOUND',

    Spaces must be used for alignment; tabs are not allowed
    Open

            }

    Spaces must be used for alignment; tabs are not allowed
    Open

                'url' => $this->controller->app['url'] ? ($this->controller->app['url'] . 'index.php?module=Users&view=LoginPassReset&mode=token&token=' . $token) : '',

    Spaces must be used for alignment; tabs are not allowed
    Open

         *

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    @OA\Put(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            {"basicAuth" : {}, "ApiKeyAuth" : {}}

    Spaces must be used for alignment; tabs are not allowed
    Open

         *          required=true,

    Spaces must be used for alignment; tabs are not allowed
    Open

         *          description="Input data",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *                 @OA\Schema(ref="#/components/schemas/Users_Put_ResetPassword_Request")

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Parameter(name="X-ENCRYPTED", in="header", @OA\Schema(ref="#/components/schemas/Header-Encrypted"), required=true),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Response(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\JsonContent(ref="#/components/schemas/Users_Put_ResetPassword_Response"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            description="User with this email address does not exist",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *         schema="Users_Post_ResetPassword_Response",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        type="object",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             property="result",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\Property(property="mailerStatus", type="boolean", example=true),

    Spaces must be used for alignment; tabs are not allowed
    Open

            $userData = (new \App\Db\Query())->from($this->controller->app['tables']['user'])

    Spaces must be used for alignment; tabs are not allowed
    Open

            if (!$userData) {

    Spaces must be used for alignment; tabs are not allowed
    Open

                'expirationDate' => date('Y-m-d H:i:s (T P)', strtotime($expirationDate)),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             @OA\MediaType(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *                 @OA\Schema(ref="#/components/schemas/Users_Put_ResetPassword_Request")

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\XmlContent(ref="#/components/schemas/Exception"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\XmlContent(ref="#/components/schemas/Exception"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            response=405,

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            description="ERR_TOKEN_DOES_NOT_EXIST",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    ),

    Spaces must be used for alignment; tabs are not allowed
    Open

                throw new \App\Exceptions\Security('ERR_TOKEN_DOES_NOT_EXIST', 405);

    Spaces must be used for alignment; tabs are not allowed
    Open

            if (!$userData) {

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\JsonContent(ref="#/components/schemas/Exception"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\XmlContent(ref="#/components/schemas/Exception"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        type="object",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            property="result",

    Spaces must be used for alignment; tabs are not allowed
    Open

         */

    Spaces must be used for alignment; tabs are not allowed
    Open

            ]);

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            response=404,

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    @OA\Schema(

    Spaces must be used for alignment; tabs are not allowed
    Open

                'to' => $userData['user_name'],

    Spaces must be used for alignment; tabs are not allowed
    Open

                ]);

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        description="User password reset - Password change",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Response(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    @OA\Schema(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *         schema="Users_Put_ResetPassword_Response",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            type="boolean",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

            $this->setAllUserData($userData);

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             type="object",

    Spaces must be used for alignment; tabs are not allowed
    Open

        public function post(): array

    Spaces must be used for alignment; tabs are not allowed
    Open

            $this->setAllUserData($userData);

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    @OA\Put(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        summary="User password reset-Passwordchange",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *         schema="Users_Put_ResetPassword_Request",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *         schema="Users_Put_ResetPassword_Request",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        type="object",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

        public function put(): bool

    Spaces must be used for alignment; tabs are not allowed
    Open

         *         schema="Users_Post_ResetPassword_Response",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

                ->limit(1)->one($db);

    Spaces must be used for alignment; tabs are not allowed
    Open

            $expirationDate = date('Y-m-d H:i:s', strtotime('+1 hour'));

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        summary="User password reset-Passwordchange",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        },

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\RequestBody(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *                 mediaType="multipart/form-data",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\JsonContent(ref="#/components/schemas/Exception"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *         schema="Users_Put_ResetPassword_Response",

    Spaces must be used for alignment; tabs are not allowed
    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"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Property(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            title="Password reset status",

    Spaces must be used for alignment; tabs are not allowed
    Open

                throw new \Api\Core\Exception(\App\Language::translate('LBL_USER_MAIL_NOT_EXIST', 'Users'), 404);

    Spaces must be used for alignment; tabs are not allowed
    Open

                $this->saveLoginHistory([

    Spaces must be used for alignment; tabs are not allowed
    Open

                $this->saveLoginHistory([

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            {"basicAuth" : {}, "ApiKeyAuth" : {}}

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\XmlContent(ref="#/components/schemas/Users_Put_ResetPassword_Response"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\JsonContent(ref="#/components/schemas/Exception"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        required={"status", "result"},

    Spaces must be used for alignment; tabs are not allowed
    Open

            }

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             property="result",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             type="object",

    Spaces must be used for alignment; tabs are not allowed
    Open

                ->where(['user_name' => $this->controller->request->get('userName'), 'status' => 1])

    Spaces must be used for alignment; tabs are not allowed
    Open

                'expirationDate' => date('Y-m-d H:i:s (T P)', strtotime($expirationDate)),

    Spaces must be used for alignment; tabs are not allowed
    Open

            if ($status) {

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        security={

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        },

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             @OA\MediaType(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        type="object",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *      @OA\Property(property="token", type="string", description="A one-time password reset token"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *      @OA\Property(property="password", type="string", description="New password"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    ),

    Spaces must be used for alignment; tabs are not allowed
    Open

            $tokenData = \App\Utils\Tokens::get($token);

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        required={"status", "result"},

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        tags={"Users"},

    Spaces must be used for alignment; tabs are not allowed
    Open

         *                 @OA\Schema(ref="#/components/schemas/Users_Put_ResetPassword_Request")

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            description="Response",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\JsonContent(ref="#/components/schemas/Exception"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            response=405,

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        required={"status", "result"},

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    ),

    Spaces must be used for alignment; tabs are not allowed
    Open

                ]);

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        path="/webservice/WebserviceStandard/Users/ResetPassword",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        security={

    Spaces must be used for alignment; tabs are not allowed
    Open

         *                 mediaType="application/x-www-form-urlencoded",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Response(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\XmlContent(ref="#/components/schemas/Users_Put_ResetPassword_Response"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        type="object",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        required={"token", "password"},

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    @OA\Schema(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            type="boolean",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    ),

    Spaces must be used for alignment; tabs are not allowed
    Open

            $db = \App\Db::getInstance('webservice');

    Spaces must be used for alignment; tabs are not allowed
    Open

                ->limit(1)->one($db);

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    @OA\Schema(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *         title="Users module - Users password reset response body",

    Spaces must be used for alignment; tabs are not allowed
    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"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         */

    Spaces must be used for alignment; tabs are not allowed
    Open

        {

    Spaces must be used for alignment; tabs are not allowed
    Open

            $id = (int) $userData['id'];

    Spaces must be used for alignment; tabs are not allowed
    Open

                'template' => 'UsersResetPassword',

    Spaces must be used for alignment; tabs are not allowed
    Open

            } else {

    Spaces must be used for alignment; tabs are not allowed
    Open

            return [

    Spaces must be used for alignment; tabs are not allowed
    Open

        /**

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *         title="Users module - Users password reset request body",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        @OA\Property(

    Spaces must be used for alignment; tabs are not allowed
    Open

            $this->updateUser([

    Spaces must be used for alignment; tabs are not allowed
    Open

                'password' => \App\Encryption::createPasswordHash($this->controller->request->getRaw('password'), $this->controller->app['type']),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\Property(property="mailerStatus", type="boolean", example=true),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

            \App\User::setCurrentUserId($userData['user_id']);

    Spaces must be used for alignment; tabs are not allowed
    Open

            ]);

    Spaces must be used for alignment; tabs are not allowed
    Open

        }

    Spaces must be used for alignment; tabs are not allowed
    Open

         *             @OA\MediaType(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *                 @OA\Schema(ref="#/components/schemas/Users_Put_ResetPassword_Request")

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            description="Response",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\JsonContent(ref="#/components/schemas/Users_Put_ResetPassword_Response"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            response=404,

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            description="User with this email address does not exist",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        required={"token", "password"},

    Spaces must be used for alignment; tabs are not allowed
    Open

         *      @OA\Property(property="password", type="string", description="New password"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            example=false,

    Spaces must be used for alignment; tabs are not allowed
    Open

                'status' => 'LBL_RESET_PASSWORD_CHANGED',

    Spaces must be used for alignment; tabs are not allowed
    Open

        }

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            description="ERR_TOKEN_DOES_NOT_EXIST",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    @OA\Schema(

    Spaces must be used for alignment; tabs are not allowed
    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"),

    Spaces must be used for alignment; tabs are not allowed
    Open

            $token = $this->controller->request->getByType('token', \App\Purifier::ALNUM);

    Spaces must be used for alignment; tabs are not allowed
    Open

            $userData = (new \App\Db\Query())->from($this->controller->app['tables']['user'])->where(['id' => $tokenData['params'][0], 'status' => 1])

    Spaces must be used for alignment; tabs are not allowed
    Open

                    'status' => 'ERR_EMAIL_NOT_FOUND',

    Spaces must be used for alignment; tabs are not allowed
    Open

                throw new \App\Exceptions\Security(\App\Language::translate('LBL_USER_MAIL_NOT_EXIST', 'Users'), 404);

    Spaces must be used for alignment; tabs are not allowed
    Open

         *      @OA\Property(property="token", type="string", description="A one-time password reset token"),

    Spaces must be used for alignment; tabs are not allowed
    Open

        {

    Spaces must be used for alignment; tabs are not allowed
    Open

                ]);

    Spaces must be used for alignment; tabs are not allowed
    Open

         *         title="Users module - Users password reset request body",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    @OA\Schema(

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            title="Password reset status",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            example=false,

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    ),

    Spaces must be used for alignment; tabs are not allowed
    Open

                $this->saveLoginHistory([

    Spaces must be used for alignment; tabs are not allowed
    Open

            $this->saveLoginHistory([

    Spaces must be used for alignment; tabs are not allowed
    Open

         *        ),

    Spaces must be used for alignment; tabs are not allowed
    Open

            ]);

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            @OA\XmlContent(ref="#/components/schemas/Exception"),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *    ),

    Spaces must be used for alignment; tabs are not allowed
    Open

         *         title="Users module - Users password reset response body",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *         title="Users module - Users password reset response body",

    Spaces must be used for alignment; tabs are not allowed
    Open

         *            property="result",

    Spaces must be used for alignment; tabs are not allowed
    Open

            if (empty($tokenData) || empty($tokenData['params'][0])) {

    Spaces must be used for alignment; tabs are not allowed
    Open

            }

    Spaces must be used for alignment; tabs are not allowed
    Open

            return true;

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @api

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /** {@inheritdoc}  */

    Spaces must be used to indent lines; tabs are not allowed
    Open

        use \Api\Core\Traits\LoginHistory;

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected function checkPermission(): void

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Post method.

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return bool

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /** {@inheritdoc}  */

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /** {@inheritdoc}  */

    Line exceeds 120 characters; contains 131 characters
    Open

         *        @OA\Parameter(name="X-ENCRYPTED", in="header", @OA\Schema(ref="#/components/schemas/Header-Encrypted"), required=true),

    Line exceeds 120 characters; contains 131 characters
    Open

         *        @OA\Parameter(name="X-ENCRYPTED", in="header", @OA\Schema(ref="#/components/schemas/Header-Encrypted"), required=true),

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected function checkPermissionToModule(): void

    Line exceeds 120 characters; contains 189 characters
    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"),

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public $allowedMethod = ['POST', 'PUT'];

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *    @OA\Post(

    Line exceeds 120 characters; contains 189 characters
    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"),

    Line exceeds 120 characters; contains 164 characters
    Open

                'url' => $this->controller->app['url'] ? ($this->controller->app['url'] . 'index.php?module=Users&view=LoginPassReset&mode=token&token=' . $token) : '',

    Line exceeds 120 characters; contains 142 characters
    Open

                'password' => \App\Encryption::createPasswordHash($this->controller->request->getRaw('password'), $this->controller->app['type']),

    Line exceeds 120 characters; contains 146 characters
    Open

            $userData = (new \App\Db\Query())->from($this->controller->app['tables']['user'])->where(['id' => $tokenData['params'][0], 'status' => 1])

    There are no issues that match your filters.

    Category
    Status