about summary refs log tree commit diff
path: root/config/initializers
diff options
context:
space:
mode:
authorOndřej Hruška <ondra@ondrovo.com>2017-09-28 09:18:35 +0200
committerOndřej Hruška <ondra@ondrovo.com>2017-09-28 09:18:35 +0200
commit83bda6c1a813c5aeb131b18a0500fed0c07fa9c2 (patch)
tree32f197901b4b16ea7f94de682fee6cdc44686045 /config/initializers
parentfcf0d2078ea813e0dd318fa154d620018e7b7bcf (diff)
parentb9f59ebcc68e9da0a7158741a1a2ef3564e1321e (diff)
Merge commit 'b9f59ebcc68e9da0a7158741a1a2ef3564e1321e' into merging-upstream
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/doorkeeper.rb9
-rw-r--r--config/initializers/ostatus.rb1
-rw-r--r--config/initializers/strong_migrations.rb3
3 files changed, 7 insertions, 6 deletions
diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb
index 689e2ac4a..074f8c410 100644
--- a/config/initializers/doorkeeper.rb
+++ b/config/initializers/doorkeeper.rb
@@ -7,15 +7,14 @@ Doorkeeper.configure do
     current_user || redirect_to(new_user_session_url)
   end
 
-  resource_owner_from_credentials do |routes|
-    request.params[:user] = { email: request.params[:username], password: request.params[:password] }
-    request.env["devise.allow_params_authentication"] = true
-    request.env["warden"].authenticate!(scope: :user)
+  resource_owner_from_credentials do |_routes|
+    user = User.find_by(email: request.params[:username])
+    user if !user&.otp_required_for_login? && user&.valid_password?(request.params[:password])
   end
 
   # If you want to restrict access to the web interface for adding oauth authorized applications, you need to declare the block below.
   admin_authenticator do
-    (current_user && current_user.admin?) || redirect_to(new_user_session_url)
+    current_user&.admin? || redirect_to(new_user_session_url)
   end
 
   # Authorization Code expiration time (default 10 minutes).
diff --git a/config/initializers/ostatus.rb b/config/initializers/ostatus.rb
index c00aba0de..ba96fda22 100644
--- a/config/initializers/ostatus.rb
+++ b/config/initializers/ostatus.rb
@@ -18,7 +18,6 @@ Rails.application.configure do
 
   config.action_mailer.default_url_options = { host: web_host, protocol: https ? 'https://' : 'http://', trailing_slash: false }
   config.x.streaming_api_base_url          = 'ws://localhost:4000'
-  config.x.use_ostatus_privacy             = true
 
   if Rails.env.production?
     config.x.streaming_api_base_url = ENV.fetch('STREAMING_API_BASE_URL') { "ws#{https ? 's' : ''}://#{web_host}" }
diff --git a/config/initializers/strong_migrations.rb b/config/initializers/strong_migrations.rb
new file mode 100644
index 000000000..3d7beac9f
--- /dev/null
+++ b/config/initializers/strong_migrations.rb
@@ -0,0 +1,3 @@
+# frozen_string_literal: true
+
+StrongMigrations.start_after = 20170924022025 if Rails.env.development?