Undefined variable, array offset errors when changing user email address.

Created on 7 February 2025, 2 months ago

Problem/Motivation

When editing the email address for a user the changes are saved but there are two errors presented in addition to the confirmation message (screenshot attached).

Steps to reproduce

Edit the email address for a Drupal admin console user that has 2FA enabled for their account.

The errors are caused by the undeclared user id check variable in the miniorange_2fa_user_presave() function in miniorange_2fa.module on line 329.

$userID != $mo_db_values['mo_auth_firstuser_id']

Proposed resolution

It's not entirely clear from the comment if the intent is to prevent the first user from changing their email address in the 2FA user management list or if this part of the conditional is extra.

If the intended behavior is to prevent the first user from changing their email address the variable needs to be declared. The current behavior is that email addresses are updated for the first user in this list when changed.

```
$variables_and_values = array(
'mo_auth_firstuser_id',
);
$mo_db_values = MoAuthUtilities::miniOrange_set_get_configurations($variables_and_values, 'GET');
```

If it's extra it can be deleted. With direction either way I'd be happy to submit a merge request, thanks!

πŸ› Bug report
Status

Active

Version

5.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States chrislarrycarl

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024