# users:disable\_2fa 작업이 보안 키를 비활성화하지 않습니다

**URL:** https://meta.discourse.org/t/task-users-disable-2fa-does-not-disable-security-keys/256547
**Category:** Bug
**Created:** [2월 28, 2023, 7:55오후 UTC](https://meta.discourse.org/t/task-users-disable-2fa-does-not-disable-security-keys/256547 "2023-02-28T19:55:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2월 28, 2023, 7:55오후 UTC](https://meta.discourse.org/t/task-users-disable-2fa-does-not-disable-security-keys/256547/1 "2023-02-28T19:55:10Z")

</div>

> <https://github.com/discourse/discourse/blob/main/lib/tasks/users.rake#L153-L159>

사용자가 보안 키를 보유하고 있는 경우, 해당 키가 삭제되지 않아 사용자는 여전히 로그인할 수 없습니다.

`UserSecondFactor`가 어딘가에서 깨져 있지 않는 한(가능성이 낮아 보이지만), 보안 키도 삭제되어야 합니다. 다음과 같은 코드가 필요합니다:

```
UserSecurityKey.where(user_id: user.id).destroy_all

```

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2월 28, 2023, 11:30오후 UTC](https://meta.discourse.org/t/task-users-disable-2fa-does-not-disable-security-keys/256547/2 "2023-02-28T23:30:09Z")

</div>

작업에 대한 합리적인 개선인 것 같은데, PR을 보내줄 수 있을까?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [3월 1, 2023, 12:01오전 UTC](https://meta.discourse.org/t/task-users-disable-2fa-does-not-disable-security-keys/256547/3 "2023-03-01T00:01:53Z")

</div>

한 줄이면 이미 처리했을 텐데, 실제로는 테스트를 하나둘 만들어야 해서 좀 더 부담스럽고 (그리고 4배의 작업량!)

하지만 내가 좀 더 어른스럽게 행동해 볼 수도 있겠지.

2FA 키를 생성한 후 그 키가 제대로 삭제되는지 확인하는 테스트 하나만 만들어도 될까? 그리고 2FA 코드 어딘가에 더미 키를 생성하는 커피(coffee)가 필요한 것 같은데?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [3월 8, 2023, 2:57오후 UTC](https://meta.discourse.org/t/task-users-disable-2fa-does-not-disable-security-keys/256547/4 "2023-03-08T14:57:23Z")

</div>

글쎄요, 이 작업에 대한 명세서가 있는 것 같지 않으므로, 단순히 한 줄입니다:

> <https://github.com/discourse/discourse/pull/20586>
>
> https://meta.discourse.org/t/task-users-disable-2fa-does-not-disable-security-ke…ys/256547
> 
> I thought I'd need to add a test, but I don't see any tests for this rake task, and the change is pretty straightforward, so maybe this single line is all that's needed.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [3월 18, 2023, 8:00오전 UTC](https://meta.discourse.org/t/task-users-disable-2fa-does-not-disable-security-keys/256547/5 "2023-03-18T08:00:27Z")

</div>

이 주제는 4일 후 자동으로 닫혔습니다. 새로운 답글을 더 이상 작성할 수 없습니다.
