You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过SSH控制台激活Discourse管理员账户?终端操作遇阻求助

Fixing Discourse Admin Account Activation Stuck in Rails Console

Hey there, let's tackle that stuck terminal issue first! When you run user = User.find_by_email("<admin_email>") and see the (END) prompt, that's because your terminal is using a pager (like less) to display the lengthy user details output.

To get back to the Rails console prompt ([1] pry (main) >), just press the q key on your keyboard. That will exit the pager view and let you continue typing commands normally.

Once you're back at the console prompt, run these commands one by one to activate and configure your admin account:

# Mark the user as an admin
user.admin = true
# Approve the user account
user.approved = true
# Save these changes to the database
user.save
# Confirm the email token to skip email verification
EmailToken.confirm(user.email_tokens.first.token)

After running user.save, you should see output like => true—that means your changes were saved successfully. The final command will validate the email token, so you won't need to wait for the verification email anymore.

Once all commands are done, you can exit the Rails console by typing exit and pressing enter, then exit the app container with another exit command. After that, you should be able to log in directly as the admin.

内容的提问来源于stack exchange,提问作者G Pritiranjan Das

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:33:36