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

SSLRequiredMixin #108

Closed
bnice5000 opened this issue Feb 26, 2014 · 5 comments
Closed

SSLRequiredMixin #108

bnice5000 opened this issue Feb 26, 2014 · 5 comments
Milestone

Comments

@bnice5000
Copy link

I would like to request that an SSLRequiredMixin be created. I have the basics of one right now. It is a modification of https://gist.github.com/drewtempelmeyer/4669799. However, I am not sure if this is a good idea or even secure. It does work. I figured that if it was in the Braces package it would be more likely to get attention from people who know what's up. Code below:

class SSLRequiredMixin(object):

    def dispatch(self, request, *args, **kwargs):
        # SSL, Debug, and Post don't mix!
        if not settings.DEBUG and not request.is_secure():
            host = request.get_host()
            url = 'https://{0}{1}'.format(host, request.get_full_path())
            return redirect(url)
        return super(SSLRequiredMixin, self).dispatch(request, *args, **kwargs)
@kennethlove kennethlove added this to the 1.5 milestone Mar 4, 2014
@kennethlove
Copy link
Member

Submit this as an actual pull request, please. Tests would make it even better. 👍

@chrisjones-brack3t
Copy link
Member

👍

@blueyed
Copy link
Contributor

blueyed commented Aug 9, 2014

👍

You mention "Post" in the comment, but then it does not appear to get handled / looked at, assuming that you are referring to POSTed data.

Please let us know in case you do not want to create the pull request yourself, and others can pick it up.

@chrisjones-brack3t chrisjones-brack3t modified the milestones: 1.6, 1.5 Dec 4, 2014
@chrisjones-brack3t
Copy link
Member

Moving this to milestone 1.6.

@chrisjones-brack3t
Copy link
Member

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants