Skip to content

Commit

Permalink
Any module that references habitat settings must use the habitat from…
Browse files Browse the repository at this point in the history
… that module directly to avoid method overrides. Fixes #1685 (#1686)
  • Loading branch information
jwoertink authored Apr 17, 2022
1 parent 1175174 commit 99d713c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions spec/lucky/subdomain_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ require "../spec_helper"
include ContextHelper

abstract class BaseAction < Lucky::Action
# https://github.com/luckyframework/lucky/issues/1685
include Lucky::ProtectFromForgery
include Lucky::Subdomain
accepted_formats [:html], default: :html
end
Expand Down
2 changes: 1 addition & 1 deletion src/lucky/protect_from_forgery.cr
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module Lucky::ProtectFromForgery

private def protect_from_forgery
set_session_csrf_token
if !settings.allow_forgery_protection? || request_does_not_require_protection? || valid_csrf_token?
if !Lucky::ProtectFromForgery.settings.allow_forgery_protection? || request_does_not_require_protection? || valid_csrf_token?
continue
else
forbid_access_because_of_bad_token
Expand Down
2 changes: 1 addition & 1 deletion src/lucky/subdomain.cr
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module Lucky::Subdomain
return if host.nil? || IP_HOST_REGEXP.matches?(host)

parts = host.split('.')
parts.pop(settings.tld_length + 1)
parts.pop(Lucky::Subdomain.settings.tld_length + 1)

parts.empty? ? nil : parts.join(".")
end
Expand Down

0 comments on commit 99d713c

Please sign in to comment.