make allowed hosts backward compatible checking user config #45
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I have seen version 1.5.1 trying to make the
allowed_hosts
backwards compatible. Unfortunately, this change does not work, because theconfig('login-link.allowed_hosts')
will merge the user configuration and the package configuration, so if the user does not have the configuration set, this helper will return the package configuration making this check useless.I have added a private method to get the user configuration first, and if it is not set, then it will not throw the exception, keeping the original idea of making it backwards compatible, although I still think it is a bad idea and it would be better to throw the exception.
I have also added 127.0.0.1 to the default list of allowed hosts.
I haven't added tests because I don't know how to fake the user configuration and the package configuration separately. I noticed the problem while checking your PR in my local environment.