How to reset Two Factor Auth settings using additional code or in DB?

The phone had been replaced so Google Authenticator app had to be reinstalled. This requires to scan a barcode and while there's no access to admin, there's no access to barcode too. The admin can't access the site because of this.

If Defender is disabled, admin can access the site but enabling it back enables 2FA again too and kicks the admin out of the site.

The "lost your phone" option is enabled but the e-mail doesn't get to the inbox, unfortunately. Is there any way to fully disable or reset 2FA for a given account using some additional code snippet or directly via DB so it could be set up again from scratch?

  • Kasia Swiderska

    Hello Tuomo,

    You should be able to disable 2FA from database - in table wp_options (wp_ is prefix, it can be different for your database) look for record wd_2auth_settings. There you will find value like that:

    a:4:{s:7:"enabled";s:1:"1";s:9:"lostPhone";s:1:"1";s:9:"userRoles";a:0:{}s:10:"isConflict";a:0:{}}

    you will need to change it to disabled, so it will look similar

    a:4:{s:8:"disabled";s:1:"1";s:9:"lostPhone";s:1:"1";s:9:"userRoles";a:0:{}s:10:"isConflict";a:0:{}}

    so this part:

    s:7:"enabled";

    is changed to this:

    s:8:"disabled";

    Because this is operation on database make sure that you make a copy of the original value of the field before changing it.

    kind regards,
    Kasia

  • Kasia Swiderska

    Hello Tuomo,

    I am afraid that change can't be done from support access. You need to have access to database, best using PhpMyAdmin - if you have access to cPanel on your hosting you will also have access to PhpMyadmin (if you are not sure about that, contact your hosting provider and ask for PHPMyAdmin) .
    Like I mentioned - table is usually wp_options but wp_ is prefix, so it can be different on for your site.

    If you are not familiar with working on database, I can do that for you, but I will need access to it. Could you please send in the following via our secure contact form https://premium.wpmudev.org/contact/#i-have-a-different-question :

    - Mark to my attention, the subject line should contain only: ATTN: Kasia Swiderska
    - Do not include anything else in the subject line, doing so may delay our response due to how email filtering works.
    - Link back to this thread
    - Include WordPress admin access details (login address, username & password)
    - Include PHPMyAdmin log-in details (url, username & password) OR cPanel credentials
    - Include any relevant URLs for your site

    IMPORTANT: Please make sure you select "I have a different question" for your topic, so it doesn't go back to the forums - this and the subject line ensure that it gets assigned to me.

    Please confirm here that you send those credentials

    kind regards,
    Kasia