I restored a backup and upon logging in, it asks me for my 2FA code which I don’t have on my phone anymore. Any way to disable 2FA on my account?
Thank you
The discussion revolves around disabling 2-factor authentication (2FA) on a Discourse account. koltl is the sole administrator and cannot access their 2FA code. codinghorror suggests that an admin can disable 2FA, but since koltl is the only admin, they need to find another solution.
koltl attempts to disable 2FA through the terminal using instructions from pfaffman, but encounters syntax errors and issues. Falco advises koltl to ignore the % symbol, which resolves one issue. However, koltl still faces problems with the final command.
featheredtoast explains that the alias has changed and provides an updated command to remove the 2FA instance for a specific user. koltl successfully uses this command and resolves the issue.
I restored a backup and upon logging in, it asks me for my 2FA code which I don’t have on my phone anymore. Any way to disable 2FA on my account?
Thank you
An admin will have to disable it for you.
I am the administrator. I understand you can do that sort of thing through the terminal but I don’t understand how.
Thank you
Maybe @featheredtoast can advise. I meant get another admin to reset it for you. Are you the only admin, or something?
I am the only admin, I think. This is an old backup
Okay and I noticed a syntax error in my screenshot so I did it correctly, same issue,

Don’ t type the % symbol on every line. Ignore that and type the rest.
The alias changed since we have multiple totps now. Also that command would remove all totp instances across all users… You probably want to do the following as the second command:
UserSecondFactor.totps.where(user_id: id).each(&:destroy!)
That worked! Thank you very much