# 恢复后被锁出我的论坛

**URL:** <https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684>\
**Category:** Support\
**Created:** [2025年一月23日 20:21 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684 "2025-01-23T20:21:46Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)\
**Post date:** [2025年一月23日 20:21 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/1 "2025-01-23T20:21:47Z")

</div>

我在恢复备份时遇到了一些问题，因为 macOS 的 `.tar` 下载，但最终还是成功了。网站已上线 [forum.imaginerio.org](https://forum.imaginerio.org)，包含所有旧帖子，但我无法使用部署期间配置的管理员账户或我旧的论坛凭据登录。在我的浏览器中，我目前看到：

```plaintext
哎呀
驱动此讨论论坛的软件遇到了意外问题。我们对此造成的不便深表歉意。

有关错误的详细信息已记录，并生成了自动通知。我们会对其进行检查。

无需进一步操作。但是，如果错误状况持续存在，您可以通过在网站的反馈类别中发布讨论主题来提供更多详细信息，包括重现错误的步骤。

```

但在隐私窗口中可以加载。使用 Google 连接时出现“出错了，也许此电子邮件已被使用”，使用 Github 连接时出现上述错误。尝试了“忘记密码”链接，但没有收到电子邮件，而 `discourse-doctor` 发送的测试电子邮件却成功送达。

是否有我可以检查的日志或在运行的容器中执行的其他操作？

这之前是一个托管实例，我从中下载了备份，现在正在自己托管，不确定这是否可能有关联。

---

<div class="post-metadata">

**Author:** ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)\
**Post date:** [2025年一月23日 20:36 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/2 "2025-01-23T20:36:37Z")

</div>

在我思考了一会儿后，我得出的结论是，这是因为我从未在我的自托管实例上配置过 Google/Github 登录，有人能证实这一点吗？如果可以，是否可以通过控制台完成？

---

<div class="post-metadata">

**Author:** ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)\
**Post date:** [2025年一月23日 20:41 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/3 "2025-01-23T20:41:34Z")

</div>

> [@martim](#):
>
> 我从未在我的自托管实例上配置过 Google/Github 登录

你会收到一个不同的错误，而不是这个错误。

实际上对我来说是有效的：

 ![图片显示了一个 Google 帐户验证屏幕，上面有“Boas-vindas！”的问候语，并确认用户的电子邮件和用户名“Supermathie”已确认且可用。（由 AI 题注）](https://global.discourse-cdn.com/meta/original/4X/f/c/c/fcc3e47e0e080bcffddf2ab5d1a27a88014385c0.png)

GitHub 也是如此。

我建议使用 [管理员后门登录](https://forum.imaginerio.org/u/admin-login)，然后检查 `/logs` 以获取有关错误的更多详细信息。

---

<div class="post-metadata">

**Author:** ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)\
**Post date:** [2025年一月24日 18:11 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/4 "2025-01-24T18:11:37Z")

</div>

谢谢 Michael。我能做到和你一样，但如果你真的尝试创建账户，它会告诉你出了问题，并且可能这个邮箱已经被注册了（但事实并非如此）。我尝试了后门登录，虽然它显示“邮件已发送”，但我的收件箱里什么都没有（而 discourse-doctor 的测试邮件却可以）。我记得我曾因为某些原因关闭了非团队成员的邮件功能，但我正在使用的邮箱绝对是团队成员的。

我还没有取消订阅。如果这个问题可以通过新建/更换管理员账户和配置来解决，你认为客服能帮我解决吗？

---

<div class="post-metadata">

**Author:** ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)\
**Post date:** [2025年一月24日 19:16 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/5 "2025-01-24T19:16:10Z")

</div>

> [@martim](#):
>
> 如果可以通过新建/更换管理员账户和配置来解决此问题，您认为客户支持可以帮助我吗？

我们可以帮助您处理托管网站的电子邮件，但无法处理自托管网站。

> [@martim](#):
>
> 新建/更换管理员账户

您可以尝试使用容器中的 `rake admin:create` 命令来创建一个新的管理员账户，然后登录该账户。

---

<div class="post-metadata">

**Author:** ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)\
**Post date:** [2025年一月24日 19:34 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/6 "2025-01-24T19:34:49Z")

</div>

> [@supermathie](#):
>
> 我们可以帮助您处理托管网站上的电子邮件，但不能处理自托管网站上的电子邮件。

该论坛是从一个托管网站恢复的，该托管网站的订阅仍然有效。由于我使用的是同一域名，因此托管网站不再公开访问，但我认为它仍在运行？我之所以这么猜测，是因为感觉我被一个可以恢复的错误配置锁定了，然后可以导出并恢复一个新的备份。

> [@supermathie](#):
>
> 您可以尝试使用容器中的 `rake admin:create` 来创建一个新的管理员帐户并登录该帐户。

这感觉_几乎_成功了。我能够创建管理员帐户，但尝试登录时出现“未知错误”（控制台中出现 500 错误）。我尝试请求登录链接，并且电子邮件成功送达，但随后再次出现：

 ![图像是一个显示“500 错误”的通知，下方有一个“确定”按钮。 (由 AI 标注)](https://global.discourse-cdn.com/meta/original/4X/b/a/f/bafebd7273377997c3f4298dad645e275b77c631.png)

---

<div class="post-metadata">

**Author:** ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)\
**Post date:** [2025年一月24日 19:36 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/7 "2025-01-24T19:36:16Z")

</div>

您将能够检查容器中的 Rails 日志（`/shared/logs/rails`）以获取错误的详细信息。

---

<div class="post-metadata">

**Author:** ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)\
**Post date:** [2025年一月24日 20:12 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/8 "2025-01-24T20:12:54Z")

</div>

在 `production.log` 中发现了一堆这样的条目：

```plaintext
Parameters: {"slug"=>"en-narratives-about", "topic_id"=>"96"}
Completed 500 Internal Server Error in 23ms (ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.0ms)
Started GET "/t/en-narratives-about/96.json" for 34.127.96.150 at 2025-01-24 19:47:25 +0000
Processing by TopicsController#show as JSON

```

这个 slug 也出现在 `nginx/access.log` 中：

```plaintext
[24/Jan/2025:20:10:19 +0000] "forum.imaginerio.org" 179.210.195.226 "POST /message-bus/a6ddfc6d2e3c4937b5eaa52ea8fdce33/poll?dlp=t HTTP/2.0" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" "-" 200 424 "https://forum.imaginerio.org/session/email-login/36ac7e1c52851f1b5c76894b04fd3c4d" 0.009 0.009 "-" "-" "-" "-" "-" "-" "-"
[24/Jan/2025:20:10:20 +0000] "forum.imaginerio.org" 34.127.96.150 "GET /t/en-narratives-about/96.json HTTP/1.1" "axios/0.21.1" "-" 500 295 "-" 0.041 0.041 "-" "-" "-" "-" "-" "-" "-"
[24/Jan/2025:20:10:23 +0000] "forum.imaginerio.org" 179.210.195.226 "POST /message-bus/d2157f777d0847eb882e0f68ab50a5f2/poll?dlp=t HTTP/2.0" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" "-" 200 424 "https://forum.imaginerio.org/" 0.005 0.005 "-" "-" "-" "-" "-" "-" "-"
[24/Jan/2025:20:10:25 +0000] "forum.imaginerio.org" 34.127.96.150 "GET /t/en-narratives-about/96.json HTTP/1.1" "axios/0.21.1" "-" 500 295 "-" 0.043 0.043 "-" "-" "-" "-" "-" "-" "-"

```

除此之外，没有太多值得注意的，除了 `/log/var-log` 中我的 `admin:create` 的确认：

```plaintext
2025-01-24T19:20:57.703680+00:00 ip-172-26-4-15-app sudo: root : TTY=pts/1 ; PWD=/var/www/discourse ; USER=discourse ; COMMAND=/usr/local/bin/bundle exec bin/rake admin:create
2025-01-24T19:20:57.704316+00:00 ip-172-26-4-15-app sudo: pam_limits(sudo:session): Could not set limit for 'core' to soft=-1, hard=-1: Operation not permitted; uid=0,euid=0
2025-01-24T19:20:57.704421+00:00 ip-172-26-4-15-app sudo: pam_unix(sudo:session): session opened for user discourse(uid=1000) by (uid=0)
2025-01-24T19:21:59.096268+00:00 ip-172-26-4-15-app sudo: pam_unix(sudo:session): session closed for user discourse
2025-01-24T19:25:01.326841+00:00 ip-172-26-4-15-app CRON[116983]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
2025-01-24T19:25:01.340674+00:00 ip-172-26-4-15-app CRON[116983]: pam_unix(cron:session): session closed for user root

```

---

<div class="post-metadata">

**Author:** ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)\
**Post date:** [2025年一月24日 20:17 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/9 "2025-01-24T20:17:44Z")

</div>

导航到 slug 时，我看到一个未找到错误：

```plaintext
{
  "errors": [
    "找不到请求的 URL 或资源。"
  ],
  "error_type": "not_found",
  "extras": {
    "title": "未找到页面",
    "html": "\n\n\n\n<div>\n <h1 class=\"title\">哎呀！此页面不存在或受保护。</h1>\n\n <a href=\"/login\" class='btn btn-primary'>\n <svg class=\"fa d-icon svg-icon svg-node\" aria-hidden=\"true\">\n <svg id=\"user\" viewBox=\"0 0 448 512\">\n <path d=\"M224 256A128 128 0 1 0 224 0a128 128 0 1 0 0 256zm-45.7 48C79.8 304 0 383.8 0 482.3C0 498.7 13.3 512 29.7 512l388.6 0c16.4 0 29.7-13.3 29.7-29.7C448 383.8 368.2 304 269.7 304l-91.4 0z\"/>\n</svg></svg>\n登录</a>\n\n</div>\n\n\n\n<div class=\"row page-not-found-topics\">\n <div class=\"recent-topics\">\n <h2 class=\"recent-topics-title\">最近</h2>\n <div class='not-found-topic'>\n <a href=\"/t/topografia-do-rio-antigo-heightmap/152\">古代河流地形图 (Heightmap)</a><a class='badge-category __wrapper ' href='/c/imaginerio/9'><span data-category-id='9' style='--category-badge-color: #25AAE2; --category-badge-text-color: #FFFFFF;' data-drop-close='true' class='badge-category ' title='在这里你可以讨论 imagineRio。'><span class='badge-category__ name'>imagineRio</span></span></a>\n </div>\n <div class='not-found-topic'>\n <a href=\"/t/titulo-e-localizacao-nao-correspondem/149\">标题和位置不匹配</a><a class='badge-category __wrapper ' href='/c/imaginerio/9'><span data-category-id='9' style='--category-badge-color: #25AAE2; --category-badge-text-color: #FFFFFF;' data-drop-close='true' class='badge-category ' title='在这里你可以讨论 imagineRio。'><span class='badge-category__ name'>imagineRio</span></span></a>\n </div>\n <div class='not-found-topic'>\n <a href=\"/t/imagens-que-nao-correspondem-a-localizacao-no-mapa/148\">与地图位置不匹配的图像</a><a class='badge-category __wrapper ' href='/c/features/12'><span data-category-id='12' style='--category-badge-color: #0088CC; --category-badge-text-color: #FFFFFF;' data-drop-close='true' class='badge-category ' title='您想在我们的地图上获得更多选项吗？创建一个新主题并填写所需数据以建议改进。'><span class='badge-category__ name'>建议改进</span></span></a>\n </div>\n <div class='not-found-topic'>\n <a href=\"/t/problema-no-login/143\">登录问题</a><a class='badge-category __wrapper ' href='/c/bugs/10'><span data-category-id='10' style='--category-badge-color: #0E76BD; --category-badge-text-color: #FFFFFF;' data-drop-close='true' class='badge-category ' title='您在我们的地图上遇到任何问题吗？创建一个新主题并填写所需数据以报告问题。'><span class='badge-category__ name'>报告问题</span></span></a>\n </div>\n <div class='not-found-topic'>\n <a href=\"/t/add-the-complete-collection-of-jean-baptiste-debret/134\">添加让-巴蒂斯特·德布雷的完整收藏</a><a class='badge-category __wrapper ' href='/c/features/12'><span data-category-id='12' style='--category-badge-color: #0088CC; --category-badge-text-color: #FFFFFF;' data-drop-close='true' class='badge-category ' title='您想在我们的地图上获得更多选项吗？创建一个新主题并填写所需数据以建议改进。'><span class='badge-category__ name'>建议改进</span></span></a>\n </div>\n <div class='not-found-topic'>\n <a href=\"/t/publicacao-de-conteudo-do-youtube/131\">发布 YouTube 内容</a><a class='badge-category __wrapper ' href='/c/features/12'><span data-category-id='12' style='--category-badge-color: #0088CC; --category-badge-text-color: #FFFFFF;' data-drop-close='true' class='badge-category ' title='您想在我们的地图上获得更多选项吗？创建一个新主题并填写所需数据以建议改进。'><span class='badge-category__ name'>建议改进</span></span></a>\n </div>\n <div class='not-found-topic'>\n <a href=\"/t/bug-na-marcacao-nos-mapas/130\">地图标记错误</a><a class='badge-category __wrapper ' href='/c/bugs/10'><span data-category-id='10' style='--category-badge-color: #0E76BD; --category-badge-text-color: #FFFFFF;' data-drop-close='true' class='badge-category ' title='您在我们的地图上遇到任何问题吗？创建一个新主题并填写所需数据以报告问题。'><span class='badge-category__ name'>报告问题</span></span></a>\n </div>\n <div class='not-found-topic'>\n <a href=\"/t/copiar-colar-a-posicao-do-mapa/129\">复制/粘贴地图位置</a><a class='badge-category __wrapper ' href='/c/features/12'><span data-category-id='12' style='--category-badge-color: #0088CC; --category-badge-text-color: #FFFFFF;' data-drop-close='true' class='badge-category ' title='您想在我们的地图上获得更多选项吗？创建一个新主题并填写所需数据以建议改进。'><span class='badge-category__ name'>建议改进</span></span></a>\n </div>\n <div class='not-found-topic'>\n <a href=\"/t/technical-issue-with-image-server/128\">图像服务器技术问题</a><a class='badge-category __wrapper ' href='/c/bugs/10'><span data-category-id='10' style='--category-badge-color: #0E76BD; --category-badge-text-color: #FFFFFF;' data-drop-close='true' class='badge-category ' title='您在我们的地图上遇到任何问题吗？创建一个新主题并填写所需数据以报告问题。'><span class='badge-category__ name'>报告问题</span></span></a>\n </div>\n <div class='not-found-topic'>\n <a href=\"/t/narrativas-problemas-de-acesso-a-plataforma/125\">叙事：平台访问问题</a><a class='badge-category __wrapper ' href='/c/bugs/10'><span data-category-id='10' style='--category-badge-color: #0E76BD; --category-badge-text-color: #FFFFFF;' data-drop-close='true' class='badge-category ' title='您在我们的地图上遇到任何问题吗？创建一个新主题并填写所需数据以报告问题。'><span class='badge-category__ name'>报告问题</span></span></a>\n </div>\n <a href=\"/latest\" class=\"btn btn-default\">更多…</a>\n </div>\n</div>\n\n\n <div class=\"row\">\n <div class=\"page-not-found-search\">\n <form action='/search' id='discourse-search'>\n <label for=\"search-input\">在此网站上搜索</label>\n <input type=\"text\" id=\"search-input\" name=\"q\" value=\"en narratives about\">\n <button class=\"btn btn-primary\">搜索</button>\n </form>\n </div>\n </div>\n\n <script defer src=\"/assets/onpopstate-handler-1ea3e951679a33d36b6c5f2f8d98016e9908c4af9110736a24b159542c83a9b8.js\" data-discourse-entrypoint=\"onpopstate-handler\" nonce=\"bJfYSa08sEXVGC4MEMEU13WAq\">\n </script>\n\n",
    "group": null
  }
}

```

---

<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:** [2025年一月24日 21:08 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/10 "2025-01-24T21:08:56Z")

</div>

是的。用户创建肯定有问题。看起来很难弄清楚。但在那些日志中，您需要查找尝试登录时发生的日志。您要找的是带有 `/login` 路径的日志，而不是 `/t/en-narratives-about/96.json`。

如果您想为您的自托管网站获得付费支持，您可以直接与我联系，无论是通过私信还是我个人资料中的联系信息。

---

<div class="post-metadata">

**Author:** ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)\
**Post date:** [2025年一月24日 22:21 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/11 "2025-01-24T22:21:55Z")

</div>

感谢您帮助我处理这个问题。我创建管理员用户后，使用 `rake admin:create` 进行登录尝试，看起来是这样的：

```plaintext
Started GET "/session/passkey/challenge.json" for 179.210.195.226 at 2025-01-24 21:13:59 +0000
Processing by SessionController#passkey_challenge as JSON
Completed 200 OK in 4ms (Views: 0.2ms | ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 2.0ms)
Started GET "/t/en-narratives-about/96.json" for 34.127.96.150 at 2025-01-24 21:14:00 +0000
Processing by TopicsController#show as JSON
  Parameters: {"slug"=>"en-narratives-about", "topic_id"=>"96"}
Completed 500 Internal Server Error in 35ms (ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.7ms)
Started POST "/session" for 179.210.195.226 at 2025-01-24 21:14:05 +0000
Processing by SessionController#create as */*
  Parameters: {"login"=>"martim", "password"=>"[FILTERED]", "second_factor_method"=>"1", "timezone"=>"America/Sao_Paulo"}
Started GET "/t/en-narratives-about/96.json" for 34.127.96.150 at 2025-01-24 21:14:06 +0000
Processing by TopicsController#show as JSON
  Parameters: {"slug"=>"en-narratives-about", "topic_id"=>"96"}
Completed 200 OK in 195ms (Views: 0.1ms | ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 4.3ms)

```

我也看到了您的尝试：

```plaintext
Started GET "/session/hp.json" for 174.50.213.142 at 2025-01-24 20:58:53 +0000
Processing by SessionController#get_honeypot_value as JSON
Completed 200 OK in 5ms (Views: 0.2ms | ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.0ms)
Started GET "/u/check_username?username=Jay_Pfaffman&email=jay%40literatecomputing.com" for 174.50.213.142 at 2025-01-24 20:58:53 +0000
Processing by UsersController#check_username as JSON
  Parameters: {"username"=>"Jay_Pfaffman", "email"=>"jay@literatecomputing.com"}
Completed 200 OK in 4ms (Views: 0.2ms | ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.0ms)

```

在此之前，我看到出现过：

```plaintext
Started GET "/session/email-login/36ac7e1c52851f1b5c76894b04fd3c4d.json" for 31.186.166.197 at 2025-01-24 20:23:25 +0000
Processing by SessionController#email_login_info as JSON
  Parameters: {"token"=>"36ac7e1c52851f1b5c76894b04fd3c4d"}
Completed 200 OK in 6ms (Views: 0.1ms | ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.0ms)

```

和

```plaintext
Started GET "/session/hp.json" for 174.50.213.142 at 2025-01-24 21:02:05 +0000
Processing by SessionController#get_honeypot_value as JSON
Completed 200 OK in 2ms (Views: 0.1ms | ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.0ms)

```

您认为重新安装并进行一些配置是否能解决这个问题？论坛上线后我立即恢复了备份。

---

<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:** [2025年一月24日 22:31 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/12 "2025-01-24T22:31:30Z")

</div>

> [@martim](#):
>
> ```plaintext
> Started GET "/session/passkey/challenge.json" for 179.210.195.226 at 2025-01-24 21:13:59 +0000
> Processing by SessionController#passkey_challenge as JSON
> 
> ```

不确定这是怎么回事。您是否为您的用户配置了通行密钥？您的帐户是否启用了双重身份验证？是否必需？

> [@martim](#):
>
> 您认为全新安装+一些配置能在此处提供帮助吗？

我不知道。我猜您可以清除数据库，看看在全新安装上帐户创建和登录是否有效。这样您就能知道是您的安装问题还是数据库问题。

类似这样：

```plaintext
cd /var/discourse
./launcher stop app
rm -rf shared/standalone/postgres*
./launcher rebuild app

```

然后看看您是否可以创建一个帐户，接收电子邮件，并且登录是否有效。

有时需要安装您之前系统上安装的任何插件。

---

<div class="post-metadata">

**Author:** ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)\
**Post date:** [2025年一月24日 22:42 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/13 "2025-01-24T22:42:27Z")

</div>

> [@martim](#):
>
> 没什么值得注意的

你检查过 `production_errors.log` 吗？

---

<div class="post-metadata">

**Author:** ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)\
**Post date:** [2025年一月24日 22:51 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/14 "2025-01-24T22:51:22Z")

</div>

> [@supermathie](#):
>
> 你检查过 `production_errors.log` 吗？

它们似乎是空的。

我明天可能会尝试全新安装，既然我已经掌握了窍门，应该会相当直接。但我一直在想这件事：

> [@martim](#):
>
> 再说一次：
> 
> ![图片是一个显示“500错误”并带有“确定”按钮的通知。 (由AI加注说明)](https://global.discourse-cdn.com/meta/original/4X/b/a/f/bafebd7273377997c3f4298dad645e275b77c631.png)

我在日志中找到的唯一 500 错误与 GET 请求的“/t/en-narratives-about/96.json”有关。它们有没有可能碍事？也许从数据库中删除它，这样它就不会被调用了？

我理解用户创建功能已损坏，但使用 `rake admin:create` 创建的管理员_似乎_是“正常工作”的……

---

<div class="post-metadata">

**Author:** ![AEW745](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/aew745/32/245540_2.png) [@AEW745](https://meta.discourse.org/u/AEW745)\
**Post date:** [2025年一月25日 00:08 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/15 "2025-01-25T00:08:17Z")

</div>

尝试转到 [https://yoursitedomain/u/admin-login](https://yoursitedomain/u/admin-login) 并启用安全模式，然后再发送电子邮件。这将禁用所有插件，同时允许您登录，以便修复插件。对 oauth 也有效。

---

<div class="post-metadata">

**Author:** ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)\
**Post date:** [2025年一月27日 13:05 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/16 "2025-01-27T13:05:22Z")

</div>

> [@AEW745](#):
>
> 在发送电子邮件之前，请开启 [安全模式](https://meta.discourse.org/t/53504?silent=true)

谢谢，尝试了这个方法，但还是出现了上面一样的 `500 error` 弹窗……这次尝试的日志如下：

```plaintext
Started GET "/session/email-login/058db4bbc47396be096cf7bed508c23e?safe_mode=no_plugins,no_themes" for 179.210.195.226 at 2025-01-27 13:04:30 +0000
Processing by SessionController#email_login_info as HTML
  Parameters: {"safe_mode"=>"no_plugins,no_themes", "token"=>"058db4bbc47396be096cf7bed508c23e"}
  Rendered layout layouts/application.html.erb (Duration: 54.6ms | GC: 1.2ms)
Completed 200 OK in 62ms (Views: 56.0ms | ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 1.2ms)
Started GET "/svg-sprite/forum.imaginerio.org/svg--ebd30ca654fdbd40604e7a7f5127b1bce16eb12b.js" for 179.210.195.226 at 2025-01-27 13:04:30 +0000
Processing by SvgSpriteController#show as */*
  Parameters: {"hostname"=>"forum.imaginerio.org", "theme_id"=>"", "version"=>"ebd30ca654fdbd40604e7a7f5127b1bce16eb12b"}
Completed 200 OK in 5ms (Views: 0.5ms | ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.0ms)
Started GET "/session/email-login/058db4bbc47396be096cf7bed508c23e.json" for 179.210.195.226 at 2025-01-27 13:04:30 +0000
Processing by SessionController#email_login_info as JSON
  Parameters: {"token"=>"058db4bbc47396be096cf7bed508c23e"}
Completed 200 OK in 253ms (Views: 0.2ms | ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.7ms)
Started GET "/session/csrf" for 179.210.195.226 at 2025-01-27 13:04:34 +0000
Processing by SessionController#csrf as JSON
Completed 200 OK in 5ms (Views: 1.1ms | ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.0ms)
Started POST "/session/email-login/058db4bbc47396be096cf7bed508c23e" for 179.210.195.226 at 2025-01-27 13:04:34 +0000
Processing by SessionController#email_login as */*
  Parameters: {"second_factor_method"=>"1", "timezone"=>"America/Sao_Paulo", "token"=>"058db4bbc47396be096cf7bed508c23e"}
Completed 500 Internal Server Error in 182ms (ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 1.4ms)

```

看起来是 `SessionController#email_login` 在处理 ` "second_factor_method"=>"1"` 时失败了？

---

<div class="post-metadata">

**Author:** ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)\
**Post date:** [2025年一月27日 14:00 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/17 "2025-01-27T14:00:45Z")

</div>

> [@pfaffman](#):
>
> 你可以清空你的数据库，看看在新安装上创建账户和登录是否正常工作。

刚试过这个方法，我能成功创建新账户。看起来是备份恢复弄坏了登录功能，我的 `.tar->.tar.gz` 是否损坏了什么？在恢复之前设置 OAuth 会有区别吗，还是会被恢复覆盖？

---

<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:** [2025年一月27日 14:10 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/18 "2025-01-27T14:10:12Z")

</div>

您是否开启了需要二次验证的系统设置？

---

<div class="post-metadata">

**Author:** ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)\
**Post date:** [2025年一月27日 14:20 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/19 "2025-01-27T14:20:22Z")

</div>

我启用了“对外部身份验证强制执行第二因素”，但关闭了“强制执行第二因素”：

 ![该图像显示了启用“对外部身份验证强制执行第二因素”的用户界面设置，该设置要求用户在 Discord 上启用双因素身份验证，然后才能使用社交登录等外部身份验证方法。（由 AI 题注）](https://global.discourse-cdn.com/meta/original/4X/2/3/a/23a60da43a96fbd658f50d84935297957a28eba3.png)

这段文字对我来说有点令人困惑。它说这将要求用户使用双因素身份验证，但也说已启用双因素的用户将被阻止使用外部身份验证登录？所以本质上它将登录限制为论坛帐户并禁用外部帐户？

---

<div class="post-metadata">

**Author:** ![martim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martim/32/482990_2.png) [@martim](https://meta.discourse.org/u/martim)\
**Post date:** [2025年一月27日 15:16 UTC](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684/20 "2025-01-27T15:16:18Z")

</div>

看起来我已经解决了。我禁用了非团队成员的电子邮件，通过 `SiteSetting.disable_emails = \"no\"` 进行更改似乎解决了问题！感谢大家的帮助，仍然不确定为什么这会导致如此混乱（我_确实_在通过控制台创建管理员时收到电子邮件，并且不确定禁用电子邮件为何会干扰注册用户登录），但现在一切都好 🙂

[下一頁](https://meta.discourse.org/t/locked-out-of-my-forum-after-restore/348684.md?page=2)
