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)

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

إعجابَين (2)

You could try:

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

This should allow you to setup a new admin account

3 إعجابات

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)

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

4 إعجابات

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 إعجابات

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 إعجابات

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)

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 إعجابات

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)

Remove their admin rights. Then you can delete them.

4 إعجابات

SiteSetting.force_https = false

he lost 2 spaces