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

Remove enforce_ssl #1804

Merged
merged 1 commit into from
May 4, 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
13 changes: 6 additions & 7 deletions app/controllers/alchemy/admin/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class BaseController < Alchemy::BaseController
include Userstamp
include Locale

before_action { enforce_ssl if ssl_required? && !request.ssl? }
before_action :load_locked_pages

helper_method :clipboard_empty?, :trash_empty?, :get_clipboard, :is_admin?
Expand Down Expand Up @@ -113,7 +112,7 @@ def render_errors_or_redirect(object, redirect_url, flash_notice)
#
def do_redirect_to(url_or_path)
respond_to do |format|
format.js {
format.js {
@redirect_url = url_or_path
render :redirect
}
Expand Down Expand Up @@ -142,11 +141,11 @@ def load_locked_pages
#
def current_alchemy_site
@current_alchemy_site ||= begin
site_id = params[:site_id] || session[:alchemy_site_id]
site = Site.find_by(id: site_id) || super
session[:alchemy_site_id] = site&.id
site
end
site_id = params[:site_id] || session[:alchemy_site_id]
site = Site.find_by(id: site_id) || super
session[:alchemy_site_id] = site&.id
site
end
end
end
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/alchemy/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class BaseController < ApplicationController
include Alchemy::AbilityHelper
include Alchemy::ControllerActions
include Alchemy::Modules
include Alchemy::SSLProtection

protect_from_forgery

Expand Down Expand Up @@ -78,7 +77,7 @@ def redirect_or_render_notice
end
format.html do
render partial: "alchemy/admin/partials/flash",
locals: {message: flash[:warning], flash_type: "warning"}
locals: { message: flash[:warning], flash_type: "warning" }
end
end
else
Expand Down
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
32 changes: 0 additions & 32 deletions lib/alchemy/ssl_protection.rb

This file was deleted.

1 change: 0 additions & 1 deletion lib/alchemy_cms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ module Alchemy
require_relative "alchemy/page_layout"
require_relative "alchemy/paths"
require_relative "alchemy/permissions"
require_relative "alchemy/ssl_protection"
require_relative "alchemy/resource"
require_relative "alchemy/tinymce"
require_relative "alchemy/taggable"
Expand Down
14 changes: 0 additions & 14 deletions spec/features/security_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,4 @@
expect(current_path).to eq(Alchemy.login_path)
end
end

context "If ssl is enforced" do
before do
allow_any_instance_of(Alchemy::BaseController)
.to receive(:ssl_required?)
.and_return(true)
authorize_user(:as_admin)
end

it "redirects every request to https." do
visit "/admin/dashboard"
expect(current_url).to eq("https://127.0.0.1/admin/dashboard")
end
end
end