Can't login after restoring

AI-generated summary

A user, Seferi, is unable to log in after restoring a Discourse forum backup on a local setup behind a Raspberry Pi Nginx reverse proxy. Despite successful restoration, login attempts fail with an ‘unknown error’ or expired password reset links. The issue is resolved by ensuring the server time is correct and adjusting the force_https setting in the Rails console. Seferi initially faced issues with CSRF errors and incorrect force_https syntax, but after correcting the command to SiteSetting.force_https = false mikechristopher and pfaffman, login was restored. Vaping_Community clarified the correct syntax. Seferi then asked how to delete unnecessary admin accounts, which pfaffman advised by removing admin rights before deletion. Moses_Jeong noted a typo in the command.

Hi,

I migrated my forum to a local device behind a Raspberry Pi Nginx reverse proxy. Installed discourse and registered and went straight to Admin section to restore from my backup. (/var/discourse/shared/standalone/backups/default) I restored successfully but afterwards I couldn’t login anymore. I tried rebuilding the app but it didn’t help. Site works fine now but it doesn’t let me login, When i try to login it says unknown error in red, when i click forgot password and enter my username i get the email to choose new password but when i enter the new password and click ok it says “Sorry, that password change link is too old. Select the Log In button and use ‘I forgot my password’ to get a new link.”
What can I do?

This might seem dumb but is the time on your server correct?

You could try:

cd /var/discourse 
./launcher enter app
rake admin:create

This should allow you to setup a new admin account

Thanks for the reply mate. Server time is correct. I followed the steps and created a new admin account but when I try to login with it, it just shows back the login screen again.. Doesn’t work.. And sometime it says unknown error in red after trying to login..

Try to login with http://your.site.com/users/admin-login

I tried. It says: [“BAD CSRF”]

Was the old site https and this one is http? If so you need to enter the rails console and

SiteSettings.force_https=false

Thanks mate, how do I enter the rails console?

If I remember right off hand its the following:

cd /var/discourse
./launcher enter app
rails c

When i do

and then

I get this:

[1] pry(main)> SiteSettings.force_https=false
NoMethodError: undefined method `force_https=' for SiteSettings:Module
from (pry):1:in `__pry__'
[2] pry(main)>

Try wrapping false in quotes

This should work..
SiteSetting.force_https = false

OR

s = SiteSetting.find_by(name: 'force_https')
s.value = 'false'  
s.save

Thanks alot guys, it worked, I can login now.. In the process I created a few admin accounts which I don’t need. How can I delete those?

Remove their admin rights. Then you can delete them.

SiteSetting.force_https = false

he lost 2 spaces