Can't login after restoring

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?

2 Likes

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

2 Likes

You could try:

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

This should allow you to setup a new admin account

3 Likes

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…

2 Likes

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

4 Likes

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
7 Likes

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
4 Likes

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)>
1 Like

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
6 Likes

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?

1 Like

Remove their admin rights. Then you can delete them.

4 Likes

SiteSetting.force_https = false

he lost 2 spaces