YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
1 hr
Test Coverage
F
42%

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

    public function post(): string
    {
        $multiFactorAuth = new \Api\Core\TwoFactorAuth($this);
        if (!$multiFactorAuth->isActive()) {
            $this->saveLoginHistory([
Severity: Minor
Found in api/webservice/WebserviceStandard/Users/TwoFactorAuth.php - About 1 hr to fix

    Missing class import via use statement (line '82', column '26').
    Open

            $multiFactorAuth = new \Api\Core\TwoFactorAuth($this);

    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 '174', column '14').
    Open

                throw new \Api\Core\Exception('A secret 2FA key has already been generated.', 401);

    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 '246', column '14').
    Open

                throw new \Api\Core\Exception($check, 401);

    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 '243', column '14').
    Open

                throw new \Api\Core\Exception('Two-factor authentication has not been enabled');

    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 '232', column '26').
    Open

            $multiFactorAuth = new \Api\Core\TwoFactorAuth($this);

    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 '151', column '26').
    Open

            $multiFactorAuth = new \Api\Core\TwoFactorAuth($this);

    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 '93', column '14').
    Open

                throw new \Api\Core\Exception('Two-factor authentication has not been enabled');

    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 '162', column '14').
    Open

                throw new \Api\Core\Exception('Two-factor authentication has not been enabled');

    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 assigning values to variables in if clauses and the like (line '245', column '7').
    Open

        public function delete(): bool
        {
            $multiFactorAuth = new \Api\Core\TwoFactorAuth($this);
            if (!$multiFactorAuth->isActive()) {
                $this->saveLoginHistory([

    IfStatementAssignment

    Since: 2.7.0

    Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($foo = 'bar') { // possible typo
                // ...
            }
            if ($baz = 0) { // always false
                // ...
            }
        }
    }

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

    Define a constant instead of duplicating this literal "Y-m-d H:i:s" 4 times.
    Open

                        'invalid_2fa_time' => date('Y-m-d H:i:s'),

    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.

    Define a constant instead of duplicating this literal "invalid_2fa_time" 4 times.
    Open

                        'invalid_2fa_time' => date('Y-m-d H:i:s'),

    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.

    Define a constant instead of duplicating this literal "ERR_2FA_NOT_BEEN_ENABLED" 3 times.
    Open

                    'status' => 'ERR_2FA_NOT_BEEN_ENABLED',

    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.

    Define a constant instead of duplicating this literal "Two-factor authentication has not been enabled" 6 times.
    Open

                        'invalid_2fa' => 'Two-factor authentication has not been enabled',

    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.

    Define a constant instead of duplicating this literal "custom_params" 3 times.
    Open

                    'custom_params' => [

    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.

    Define a constant instead of duplicating this literal "invalid_2fa" 4 times.
    Open

                        'invalid_2fa' => 'Two-factor authentication has not been enabled',

    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.

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

                    'status' => 'ERR_2FA_NOT_BEEN_ENABLED',

    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;

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

         * @return array

    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\Response(

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

         *            response=200,

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

         *            description="Authentication secret details",

    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_Get_TwoFactorAuth_Response"),

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

         *            description="Invalid method",

    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

         *            response=500,

    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

         *            @OA\JsonContent(ref="#/components/schemas/Users_Get_TwoFactorAuth_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

         *        @OA\Response(

    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\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\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

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

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

         *        summary="2FA details",

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

         *        security={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},

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

         *            description="Two-factor authentication has not been enabled",

    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="Get two factor authentication details",

    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\JsonContent(ref="#/components/schemas/Exception"),

    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\JsonContent(ref="#/components/schemas/Users_Get_TwoFactorAuth_Response"),

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

         *            description="Two-factor authentication has not been enabled",

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

         *    ),

    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

                        'invalid_2fa' => 'Two-factor authentication has not been enabled',

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

            if (empty($this->getUserData('auth')['authy_secret_key'])) {

    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

         *            description="Access details",

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

         *            response=500,

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

         *         title="Users module - Activate two factor authentication",

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

         *             type="string",

    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

                    ],

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

                return $multiFactorAuth->generate();

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

            return $multiFactorAuth->details();

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

         *            description="Access details",

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

            $multiFactorAuth = new \Api\Core\TwoFactorAuth($this);

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

                ]);

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

                $this->updateUser([

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

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

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

         *            description="Authentication secret details",

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

         *        ),

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

         *            description="Invalid method",

    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

         *        summary="2FA details",

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

         *            @OA\XmlContent(ref="#/components/schemas/Users_Get_TwoFactorAuth_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

         *            response=405,

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

         *        ),

    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="Content of responses from a given method",

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

         *             required={"authMethods", "secretKey"},

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

                $this->saveLoginHistory([

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

         *        security={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},

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

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

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

         *            description="Invalid method",

    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

         *         description="Activate two factor authentication response body",

    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

         *            response=405,

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

         *        ),

    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

        public function get(): array

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

                throw new \Api\Core\Exception('Two-factor authentication has not been enabled');

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

         * @throws \Api\Core\Exception

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

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

    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

         *    @OA\Get(

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

         *        description="Get two factor authentication details",

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

         *        security={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},

    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

         *            response=500,

    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\Schema(

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

         *        tags={"Users"},

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

         *            description="Invalid method",

    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

         *             property="result",

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

         *        @OA\Property(

    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

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

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

         *            response=500,

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

         *         title="Users module - Activate two factor authentication",

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

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

    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 - Authentication secret details",

    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="secretKey", type="string", example="LJUJWCOEGUKP6WS2"),

    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

                $this->updateUser([

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

            }

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

         *        summary="Activate 2FA",

    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=405,

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

         *        ),

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

         *            description="`Two-factor authentication has not been enabled` OR `A secret 2FA key has already been generated.`",

    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\Property(property="authMethods", type="string", example="TOTP"),

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

            $multiFactorAuth = new \Api\Core\TwoFactorAuth($this);

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

         *        description="Activate two factor authentication",

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

         *            description="`Two-factor authentication has not been enabled` OR `A secret 2FA key has already been generated.`",

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

         *        ),

    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

                    'status' => 'ERR_2FA_NOT_BEEN_ENABLED',

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

         * @OA\Post(

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

         *        security={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},

    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_post_TwoFactorAuth_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

         *    @OA\Schema(

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

         *             type="string",

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

                        'invalid_2fa_time' => date('Y-m-d H:i:s'),

    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

         * Post method.

    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\JsonContent(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

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

    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

         *        schema="Users_Delete_TwoFactorAuth_Response",

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

         *            property="status",

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

         *            property="status",

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

         *        schema="Users_Get_TwoFactorAuth_Response",

    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

         * @api

    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_post_TwoFactorAuth_Response",

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

        public function post(): string

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

                    'custom_params' => [

    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={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},

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

         *            @OA\JsonContent(ref="#/components/schemas/Users_Delete_TwoFactorAuth_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

         *        ),

    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(

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

         *            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

         *            type="boolean",

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

         */

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

                    'custom_params' => [

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

                throw new \Api\Core\Exception('Two-factor authentication has not been enabled');

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

         *        schema="Users_Get_TwoFactorAuth_Response",

    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

                ]);

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

         *

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

         * @return array

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

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

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

         *        summary="Activate 2FA",

    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\Response(

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

         *         schema="Users_post_TwoFactorAuth_Response",

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

         *         description="Activate two factor authentication response body",

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

            if (!$multiFactorAuth->isActive()) {

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

                throw new \Api\Core\Exception('Two-factor authentication has not been enabled');

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

                        'invalid_2fa' => 'A secret 2FA key has already been generated.',

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

         *            response=405,

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

         *        @OA\Property(

    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

         *        description="Activate two factor authentication",

    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

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

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

         *        @OA\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

         *        @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

         *    ),

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

                    'status' => 'ERR_2FA_NOT_BEEN_ENABLED',

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

                        'invalid_2fa' => 'Two-factor authentication has not been enabled',

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

         *        tags={"Users"},

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

         *            description="Two-factor authentication has not been enabled",

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

         *        ),

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

         *            enum={0, 1},

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

         *            property="result",

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

         *            description="Status of successful",

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

         *            type="boolean",

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

                throw new \Api\Core\Exception($check, 401);

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

         *        title="Users module - Authentication secret details",

    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(property="authMethods", type="string", example="TOTP"),

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

            if (!$multiFactorAuth->isActive()) {

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

                        'invalid_2fa_time' => date('Y-m-d H:i:s'),

    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_post_TwoFactorAuth_Response")

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

                $this->saveLoginHistory([

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

                throw new \Api\Core\Exception('A secret 2FA key has already been generated.', 401);

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

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

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

         *            description="Disable two factor authentication response",

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

         *            @OA\JsonContent(ref="#/components/schemas/Users_Delete_TwoFactorAuth_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

         *            @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

         * ),

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

                    ],

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

            $multiFactorAuth->delete();

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

         *            response=200,

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

         *        ),

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

         *            response=500,

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

         *            response=500,

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

         *        schema="Users_Delete_TwoFactorAuth_Response",

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

                    'status' => 'ERR_2FA_NOT_BEEN_ENABLED',

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

                        'invalid_2fa_time' => date('Y-m-d H:i:s'),

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

         * @api

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

         *        security={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},

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

         *            description="Disable two factor authentication response",

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

         *            description="Two-factor authentication has not been enabled",

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

         *        title="Users module - Disable two factor authentication",

    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->updateUser([

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

         * @return bool

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

         *             type="integer",

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

         *        @OA\Property(

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

         *            description="Status of successful",

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

            $multiFactorAuth = new \Api\Core\TwoFactorAuth($this);

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

                        'invalid_2fa_time' => date('Y-m-d H:i:s'),

    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\Delete(

    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

         *        @OA\Response(

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

         *             type="integer",

    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

            return $multiFactorAuth->activate();

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

         *        summary="Disable 2FA",

    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

         *            response=405,

    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\JsonContent(ref="#/components/schemas/Exception"),

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

         *            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

         *            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

         *        required={"status", "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

         *             type="object",

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

         *             required={"authMethods", "secretKey"},

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

         *           @OA\Property(property="secretKey", type="string", example="LJUJWCOEGUKP6WS2"),

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

                    'auth' => [

    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_TwoFactorAuth_Response")

    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

         *        @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

         *             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

            if (!empty($this->getUserData('auth')['authy_secret_key'])) {

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

                    'status' => 'ERR_2FA_ALREADY_GENERATED',

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

        /**

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

         * Delete record.

    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_Delete_TwoFactorAuth_Response"),

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

         *            description="Invalid method",

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

         *        description="Disable two factor authentication 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

         *            enum={0, 1},

    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

         *            description="Invalid method",

    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\Property(

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

        public function delete(): bool

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

                        'invalid_2fa' => 'Two-factor authentication has not been enabled',

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

        }

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

         *        summary="Disable 2FA",

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

         *        description="Disable two factor authentication",

    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

            if ($check = $multiFactorAuth->check()) {

    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 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/TwoFactorAuth",

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

         *        description="Disable two factor authentication",

    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

                    'custom_params' => [

    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=200,

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

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

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

         *        description="Disable two factor authentication response",

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

         *        ),

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

                $this->updateUser([

    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

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

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

         *        title="Users module - Disable two factor authentication",

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

         *        type="object",

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

            if (!$multiFactorAuth->isActive()) {

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

         * @return array

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

        protected function checkPermissionToModule(): 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

        /** {@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

        public $allowedMethod = ['GET', 'POST', 'DELETE'];

    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

        use \Api\Core\Traits\LoginHistory;

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

        {

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

        }

    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

         *    @OA\Get(

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

         * Get two factor authentication details.

    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

        /** {@inheritdoc}  */

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

         *

    Line exceeds 120 characters; contains 129 characters
    Open

         *            description="`Two-factor authentication has not been enabled` OR `A secret 2FA key has already been generated.`",

    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 130 characters
    Open

         *            description="A numeric value of 0 or 1 that indicates whether the communication is valid. 1 - success, 0 - error",

    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 131 characters
    Open

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

    There are no issues that match your filters.

    Category
    Status