Maybe I’m missing something obvious, but I cannot find it. As an admin, can I change someone’s email address without them having to verify it?
Off-hand, I’d guess something like this would work:
cd /var/discourse
./launcher enter app
rails c
User.find_by(email: "chowder@mmmm.fooo").update(email: "bisque@soup.mmmm")
exit
exit
That’s console access, obviously.
I vaguely recall another topic here about this exact situation; try some searches.
Try this, the verification mail goes out, but they don’t have to respond to it:
Too late for me to edit that now, but it should be deactivate, change, reactivate iirc.
No problem I made it a wiki.
I am a new discourse user and I ran into the same issue. When I try the same approach (deactivate the user, update the email address, and then activate the user) it sending an email to confirm and it is only updating the email address after clicking the confirm email link. Is there a way to avoid this? I am using the API to do all the three actions.
There has been a change in the way emails are stored in the database.
The following commands should work:
cd /var/discourse
sudo ./launcher enter app
rails c
UserEmail.find_by(email: "oid@example.com").update(email: "new@example.com")
This will work fine but I am trying to do this via API as I will have to update multiple email addresses on a daily basis. Is it possible to do this via API?
대규모 네크로맨시(Massive Necromancy)는 맞지만, 저는 유사한 문제를 겪고 있으며 검색 결과 이 게시글로 오게 되어 이 경험을 바탕으로 명령어를 업데이트하는 것이 관련이 있을 수 있습니다.
제 상황은 다음과 같습니다:
- 일부 사용자가 주요 이메일 주소를 변경하려고 시도했습니다.
- 그들은 작동하지 않았다고 주장합니다. 확인용 이메일은 받았지만 링크를 클릭하면 항상 "만료됨/작동 안 함"이라는 메시지가 표시됩니다.
- 저는 관리자(Admin) 권한으로 해당 이메일을 변경하러 가서 프로필을 편집하여 변경했습니다.
- 이제 주요 이메일은 “확인/검증 대기” 상태입니다.
- 사용자는 확인용 이메일을 전혀 받지 못합니다.
- 프로필에서 “검증/확인 이메일 재전송” 옵션을 아무리 많이 눌러도 이메일이 발송되지 않습니다(관리자/이메일 섹션에서 확인했는데, 해당 이메일에 대한 발신 기록이 없습니다. 아이러니하게도 "비밀번호 재설정 이메일"을 보내라고 클릭하면 그 이메일은 발송됩니다).
문제는, 해당 사용자 중 누군가가 쿠키 등을 정리하면 계정에 다시 접근할 수 없게 된다는 점입니다(지금 실제로 일어나고 있습니다). 그래서 이렇게 시도해 보았습니다:
하지만 NoMethodError: undefined method `update' for nil:NilClass 오류가 발생합니다. 아마도 지난 2년 사이에 필드가 다시 변경되었을까요? ![]()
어떤 도움도 환영합니다.
참고: 또한 이메일을 다른 것으로 변경하거나 원래 이메일로 되돌리려 하면, 이제 저(관리자)에게 "이 작업을 너무 많이 수행했습니다. 나중에 다시 시도해 주세요"라는 메시지가 표시됩니다. '나중’은 얼마나 뒤를 의미하며, 저는 한 번만 수행했는데 왜 관리자가 이메일 변경 시 속도 제한(rate limited)을 받는 것일까요? 아마 제가 무언가를 잘못해서 인지하지 못한 것 같습니다 ![]()
이메일 전송은 정상적으로 이루어지고 있으니, 서버 시간이 틀렸거나 부정확한 것일 수 있습니다. 서버 시간이 틀려 있으면 이러한 문제가 발생할 수 있습니다.
저는 잘 작동했습니다! 이 문제를 여전히 겪고 계신 분이나 이 주제를 발견하신 다른 분들을 위해
, UserEmail.find_by(email: "oid@example.com")가 아무것도 반환하지 않으면 해당 오류가 발생할 것 같습니다. 이메일 주소가 정확히 일치하는지 한 번 더 확인해 보시는 것이 좋겠습니다.