Add "Reset 2FA" action to users CRM

This commit is contained in:
Adrian Gruntkowski 2024-04-22 17:44:07 +02:00
parent 177cfc162b
commit b2cd26b262

View File

@ -54,6 +54,10 @@ defmodule Plausible.Auth.UserAdmin do
lock: %{ lock: %{
name: "Lock", name: "Lock",
action: fn _, user -> lock(user) end action: fn _, user -> lock(user) end
},
reset_2fa: %{
name: "Reset 2FA",
action: fn _, user -> disable_2fa(user) end
} }
] ]
end end
@ -77,6 +81,10 @@ defmodule Plausible.Auth.UserAdmin do
end end
end end
def disable_2fa(user) do
Plausible.Auth.TOTP.force_disable(user)
end
defp grace_period_status(%{grace_period: grace_period}) do defp grace_period_status(%{grace_period: grace_period}) do
case grace_period do case grace_period do
nil -> nil ->