Skip to content

2.4.8 Can't create New Administrator with 2FA enabled #40124

@ajung2

Description

@ajung2

Preconditions and environment

  • Magento version 2.4.8
  • Anything else that would help a developer reproduce the bug

Steps to reproduce

  1. Enable 2FA in Magento
  2. Login in Magento backend
  3. Stores > Permissions > All Users > Add New User
  4. Put only necessary data to Save User
  5. No Error but redirected to backend start page

Expected result

Create new Admin user.

Actual result

Got redirected to startpage with no error msg, also no logs in exception.log

Additional information

Troubleshooting in IDE:

Spin Up Debugger on Save Button, catch Exception
Magento\TwoFactorAuth\Model\UserConfigManager::getProvidersCodes(): Return value must be of type array, null returned

Set debugger on
module-two-factor-auth/Model/UserConfigManager.php
$userConfig = $this->getUserConfiguration($userId);

Sometimes get NULL from $userConfig then it crash of return type error.

Here my fix for this problem

public function getProvidersCodes(int $userId): array
{
    $userConfig = $this->getUserConfiguration($userId);

    //this if fixed the issue
    if (!$userConfig->getData('providers')) {
        return [];
    }
    return $userConfig->getData('providers');
}

Release note

Create new Administrator with 2FA enabled fail!

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Issue: needs updateAdditional information is require, waiting for responseReported on 2.4.8Indicates original Magento version for the Issue report.

Type

No type

Projects

Status

Needs Update

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions