Can't enable 2FA

Somehow I can't enable 2FA, the button is grayed out even after entering the correct code.

The button will be enabled and it will turn green, only if the typed code is valid:

Please try again.

Also, maybe you are using some incompatible app version.

Which app are you using?
Did you try other authentication apps?

I tried many times, I used Aegis authenticator app from F-Droid with TOTP type.

Did you try other authentication apps?

Also, check if the devices date and time are correct.

I can't reproduce your observation - I have no issues using Aegis 3.4.2 with Pi-hole:

This makes a timing issue as more likely.