Help, I disabled local logins and can't get back


#1

I chose “local logins disabled”, however, I did not add Facebook or twitter login, I can’t login my site as admin.

Any suggestions?


First time login when local logins are disabled is confusing
(Kane York) #2

You’re going to need to do a rails console recovery.

Do you have a Docker-based install or a hosted install? If hosted, contact your hosting provider (probably team@discourse.org or discoursehosting.com).

For Docker:

./launcher enter app
rails c
SiteSetting.local_logins_enabled = true
exit

#3

When I run command above

it shows

WARNING: No swap limit support
Downloading nsenter
Pulling repository samsaffron/nsenter
FATA[0000] Get https://index.docker.io/v1/repositories/samsaffron/nsenter/images: Bad Request
Unable to find image ‘samsaffron/nsenter:latest’ locally
Pulling repository samsaffron/nsenter
time=“2015-02-19T16:25:27+08:00” level=“fatal” msg=“Get https://index.docker.io/v1/repositories/samsaffron/nsenter/images: Bad Request”

How can I do?


(Kane York) #4

Does the server have an uninterrupted connection to the net, or is it passing through an intercepting proxy?

In the meantime, try ./launcher ssh app instead.


#5

I have vim the /etc/default/docker

and can get into rails c

but execute sitsetting.lcoal_logins_enabled = true

it shows

root@discuss-app:~# rails c
[1] pry(main)> SiteSetting.local_logins_enabled = true
NoMethodError: undefined method local_logins_enabled=' for #<Class:0x007f7f5487aa20> from /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.1.8/lib/active_record/dynamic_matchers.rb:26:inmethod_missing’

How can I do?


(Kane York) #6

Oops, change that to “enable_local_logins”, serves me right for not actually looking up what it’s called.


#7

All done

Seems did not work.

How can I do…


#8

Are there any other options about login will cause this problem?

I am not sure how many box I diselected days ago in the login options in settings.

Here is my site.

When you click login or sign up, no blank to type user name and psw…


(Kane York) #9

Let’s see the output of this. Scrub sensitive data.

puts SiteSetting.all.map {|s| "#{s.name}: #{s.value}" } .join "\n"

edit: it would appear you have no login methods enabled, fun fun fun


#10

It shows

uncategorized_category_id: 1
lounge_category_id: 2
meta_category_id: 3
staff_category_id: 4
tos_topic_id: 4
guidelines_topic_id: 5
privacy_topic_id: 6
last_vacuum: 1423994069
has_login_hint: f
global_notice:
title: Eye Doctor
site_description: Eye Doctor’s Garden
notification_email: noreply@voops.com
contact_email: vi8@1gm.com
logo_url:
logo_small_url:
favicon_url:
apple_touch_icon_url:
category_style: box
default_locale: en
limit_suggested_to_category: t
site_contact_username: doudu
embeddable_host: vopps.com
embed_by_username: doudu
embed_category: Blog
feed_polling_url: http://vodpps.com/index.xml
feed_polling_enabled: t
enable_local_logins: f
=> nil

and run ./launcher rebuild app

Nothing happens.

Have I to rebuild the site?


(Kane York) #11

So, the change didn’t actually take. You should’ve seen something like this:

[7] pry(main)> SiteSetting.enable_local_logins = true
  SiteSetting Load (0.5ms)  SELECT  "site_settings".* FROM "site_settings"  WHERE "site_settings"."name" = 'enable_local_logins' LIMIT 1
   (0.1ms)  BEGIN
  SQL (0.3ms)  INSERT INTO "site_settings" ("created_at", "data_type", "name", "updated_at", "value") VALUES ($1, $2, $3, $4, $5) RETURNING "id"  [["created_at", "2015-02-19 09:41:37.219896"], ["data_type", 5], ["name", "enable_local_logins"], ["updated_at", "2015-02-19 09:41:37.219896"], ["value", "t"]]
   (1.7ms)  COMMIT
=> true
[8] pry(main)>

Try again maybe?

Won’t help, rebuild keeps the database.


#12

God
It works.

Could the team add some notice when somebody do this like me to avoid the same condition.

Many thanks.

Some advice: Could the team add twitter, Facebook, google api login options (use a public or the team maintaince account to verify the login) by default?

So we can just click the box to login with those accounts, avoiding the trouble to create apis step by step.


(Kane York) #13

Unfortunately, that’s a step that’s impossible to remove. Google just removed zero-setup logins in Q3 last year or so.


(Kane York) #14

Update to this topic: if anyone finds themselves on this situation, go to /users/admin-login to log in via email.


(Kane York) #15