Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate require_ssl (4.6) #1842

Merged
merged 1 commit into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions config/alchemy/config.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# == This is the global Alchemy configuration file
#

# === Require SSL for login form and all admin modules
#
# NOTE: You have to create a SSL certificate on your server to make this work
#
require_ssl: false

# === Auto Log Out Time
#
# The amount of time of inactivity in minutes after which the user is kicked out of his current session.
Expand Down
1 change: 1 addition & 0 deletions lib/alchemy/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def show
def deprecated_configs
{
url_nesting: true,
require_ssl: nil,
}
end

Expand Down
4 changes: 3 additions & 1 deletion lib/alchemy/ssl_protection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def ssl_required?

# Redirects current request to https.
def enforce_ssl
redirect_to url_for(request.params.merge(protocol: 'https'))
redirect_to url_for(request.params.merge(protocol: "https"))
end

deprecate :enforce_ssl, deprecator: Alchemy::Deprecation
end
end
11 changes: 3 additions & 8 deletions spec/libraries/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,10 @@ module Alchemy

context "if config is deprecated" do
context "without a new default" do
before do
expect(described_class).to receive(:deprecated_configs).at_least(:once) do
{ url_nesting: nil }
end
end

it "warns" do
expect(Alchemy::Deprecation).to receive(:warn)
Config.get(:url_nesting)
expect(Alchemy::Deprecation).to \
receive(:warn).with("require_ssl configuration is deprecated and will be removed from Alchemy 5.0")
Config.get(:require_ssl)
end
end

Expand Down