הייתה לי התקנה זו
forum.example.com
היה לי את חשבון הניהול שלי admin@example.com עם הסיסמה שלי ואימות דו-שלבי (2FA)
בסופו של דבר החלטתי להעביר את זה לדומיין חדש
community.newexample.com
לפני שעשיתי זאת, יצרתי גיבוי של forum.example.com
היום החלטתי שאני רוצה ליצור קהילה חדשה ב-example.com
התקנתי הכל, יצרתי את חשבון הניהול החדש (admin 2), וכו’.
התחברתי.
עברתי למקטע הגיבויים והעליתי את הגיבוי שיצרתי עבור forum.example.com
זה ניתק אותי.
כשניסיתי להתחבר באמצעות פרטי הכניסה החדשים עבור “admin 2”, זה לא איפשר לי, כי אני מניח שזה מנסה כעת להשתמש בפרטי הכניסה מההתקנה הראשונה.
הבעיה היא גם שאין לי יותר את האימות הדו-שלבי (2FA) עבור forum.example.com, אבל זה מבקש גם את זה.
מה אני יכול לעשות עכשיו?
UPDATE: I was able to do it by following ChatGPT’s instructions:
Step 1: SSH into your server
ssh your-user@your-server
Step 2: Enter the Discourse app container
cd /var/discourse
./launcher enter app
Step 3: Create or reset the admin user’s password
This step ensures you can log in with a known password.
rake admin:create
- When prompted, enter the email address of the admin from the backup (e.g.
admin@forum.example.com).
- Enter a new password.
- Type
Y when asked to grant admin privileges (even if the user already is an admin — it won’t hurt).
Step 4: Open the Rails console
rails c
Step 5: Find the user by email
Replace the email with the one you’re resetting:
user = User.find_by_email("admin@forum.example.com")
You should see some output showing the user object.
Step 6: Disable 2FA for that user
user.user_second_factors.destroy_all
This deletes all 2FA keys associated with that user — without affecting anyone else.
Step 7: Exit the console and container
exit
Step 8: Log in via the web
Go to your Discourse site in the browser and log in with:
- Email:
admin@forum.example.com
- Password: the one you set in Step 3
- 2FA: will no longer be required