# Cannot disable 2FA for User

**URL:** <https://meta.discourse.org/t/cannot-disable-2fa-for-user/178474>\
**Category:** Product Support\
**Created:** [February 4, 2021, 10:22pm UTC](https://meta.discourse.org/t/cannot-disable-2fa-for-user/178474 "2021-02-04T22:22:30Z")\
**Posts on this page:** 7\
**Page:** 1

## AI-generated summary

A user is unable to disable 2FA for a specific user via the admin interface, receiving an 'invalid parameters' error. The issue arises because the user has a `UserSecurityKey` record but no `UserSecondFactor` record, preventing the UI from functioning correctly. [Brandon_Martus](/t/-/178474/4) resolves the issue by removing the `UserSecurityKey` via the Rails console, which successfully disables 2FA. [omarfilip](/t/-/178474/2) suggests using the console, while [jomaxro](/t/-/178474/3) and [Falco](/t/-/178474/5) highlight that the site is running an outdated and unsupported version of Discourse (**2.5.0.beta4**), missing critical security fixes, and recommend an immediate upgrade.

<div class="post-metadata">

**Author:** ![Brandon\_Martus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brandon_martus/32/127631_2.png) [@Brandon\_Martus](https://meta.discourse.org/u/Brandon_Martus)\
**Post date:** [February 4, 2021, 10:22pm UTC](https://meta.discourse.org/t/cannot-disable-2fa-for-user/178474/1 "2021-02-04T22:22:30Z")

</div>

We have a user with 2FA enabled, and we cannot disable it for them.

Clicking the ‘Disable’ button on their account gives us:

 ![image](https://global.discourse-cdn.com/meta/original/3X/8/e/8e789276d9e00445aa1e7c3f56a05f53e63fa4f1.png)  
(You supplied invalid parameters to the request: Discourse::InvalidParameters)

There is no row in the `users_second_factors` table for the user\_id. I’ve tried adding a dummy row, which lets me click the ‘Disable’ button without error, but just deletes my dummy row and still leaves 2FA enabled for the user.

I’ve also tried the `rake users:disable_2fa[username]` rake task, which says `2FA disabled for user`, but still shows `Two Factor Authentication: Yes` on the user’s profile in admin.

Anything else I can try?

---

<div class="post-metadata">

**Author:** ![omarfilip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omarfilip/32/208019_2.png) [@omarfilip](https://meta.discourse.org/u/omarfilip)\
**Post date:** [February 4, 2021, 10:35pm UTC](https://meta.discourse.org/t/cannot-disable-2fa-for-user/178474/2 "2021-02-04T22:35:53Z")

</div>

Try via the rails console:

> [@Disable 2FA via console](https://meta.discourse.org/t/disable-2fa-via-console/148309):
>
> bookmark This guide provides instructions for administrators on how to disable two-factor authentication (2FA) via the console. person_raising_hand Required user level: System Admin wrench Console access required warning This guide should only be used when 2FA cannot be disabled from the user admin page. Discourse supports three types of 2-factor options: TOTP (6-digit codes rotating every 30 seconds), security key (Yubikey, biometric, etc.), and backup codes. Sometimes…

---

<div class="post-metadata">

**Author:** ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)\
**Post date:** [February 5, 2021, 12:47am UTC](https://meta.discourse.org/t/cannot-disable-2fa-for-user/178474/3 "2021-02-05T00:47:41Z")

</div>

It’d also be good to know what version of Discourse you are running. There have been fixes for the inability to disable 2FA via the UI since the first release of 2FA.

---

<div class="post-metadata">

**Author:** ![Brandon\_Martus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brandon_martus/32/127631_2.png) [@Brandon\_Martus](https://meta.discourse.org/u/Brandon_Martus)\
**Post date:** [February 5, 2021, 2:53pm UTC](https://meta.discourse.org/t/cannot-disable-2fa-for-user/178474/4 "2021-02-05T14:53:01Z")

</div>

Thanks @omarfilip .. I did the UserSecondFactor delete but didn’t know about UserSecurityKey.

This user had no UserSecondFactor record, but they did have a UserSecurityKey record.

Once I removed that, their profile shows ‘Two Factor Authenciation: No’ – thanks!

@jomaxro We’re on **2.5.0.beta4** ( [8d3900c6da](https://github.com/discourse/discourse/commits/8d3900c6daddb52c025bc42b0aa60fe3bcb1b61f))

Seems like there still is an issue where I should be able to do this via the UI, but get the invalid parameters issue, possibly due to the missing UserSecondFactor record?

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [February 5, 2021, 4:31pm UTC](https://meta.discourse.org/t/cannot-disable-2fa-for-user/178474/5 "2021-02-05T16:31:21Z")

</div>

> [@Brandon\_Martus](#):
>
> @jomaxro We’re on **2.5.0.beta4** ( [8d3900c6da](https://github.com/discourse/discourse/commits/8d3900c6daddb52c025bc42b0aa60fe3bcb1b61f))

That version is old and unsupported, update as soon as possible.

---

<div class="post-metadata">

**Author:** ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)\
**Post date:** [February 5, 2021, 7:56pm UTC](https://meta.discourse.org/t/cannot-disable-2fa-for-user/178474/6 "2021-02-05T19:56:39Z")

</div>

Besides being old and unsupported, you’re also missing over a dozen security fixes, so your site is vulnerable. Please do upgrade.

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [March 7, 2021, 7:57pm UTC](https://meta.discourse.org/t/cannot-disable-2fa-for-user/178474/7 "2021-03-07T19:57:37Z")

</div>

Closed on March 7, 2021, 7:57pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
