Problem/Motivation

When enabling the "Override login form username title and description" setting in the miniorange_2fa module, and entering any custom string into the "Login form username title" field, the value is not saved correctly. It is always stored as the string "0" regardless of the input.

As a result, when viewing the login form, a fatal error occurs:
$string ("0") must be a string.

This makes the login form unusable.

Disabling the override option avoids the error, but we want to customize the form text to make it clearer for users. This is a blocking issue and needs to be fixed urgently.

Steps to reproduce

Navigate to Configuration > People > miniOrange Two Factor Settings.

Enable "Override login form username title and description".

Enter any string (e.g., Please enter your username) into "Login form username title".

Save the configuration.

Visit the login page.

Observe the error:
$string ("0") must be a string.

Proposed resolution

Ensure that the value entered into "Login form username title" is correctly stored and retrieved as a valid string. Prevent any unintended type casting or overwriting with "0".

Remaining tasks

Investigate the form submission handler and config saving logic.

Correct the data handling for this specific field.

Add validation to ensure "0" is not unintentionally used or stored.

Add tests to prevent regressions.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

kohei_iwamura created an issue. See original summary.

kohei_iwamura’s picture

StatusFileSize
new440.59 KB
kohei_iwamura’s picture

StatusFileSize
new300.2 KB
sudhanshu0542’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new1.06 KB

Hello @kohei_iwamura, thank you for bringing this to our attention. I have reviewed this issue and created a patch for it. Could you please apply this patch and let me know if it resolves your issue?

sudhanshu0542’s picture

Assigned: Unassigned » sudhanshu0542
sudhanshu0542’s picture

Priority: Critical » Normal
kohei_iwamura’s picture

StatusFileSize
new476 bytes
kohei_iwamura’s picture

@sudhanshu0542

Thank you. The patch you provided couldn't be applied as-is, so I reviewed the contents and adjusted the relevant lines. After that, the patch applied successfully and resolved the issue. I've uploaded the updated patch file in comment https://www.drupal.org/project/miniorange_2fa/issues/3525717#comment-161....

sudhanshu0542’s picture

Status: Needs review » Fixed

I am closing this issue; the fix for this is addressed in the 5.3.0 release. Thanks, @kohei_iwamuran for your cooperation.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

sudhanshu0542’s picture

Status: Fixed » Closed (fixed)

Closing this issue.