Skip to main content

Next url mixin witch doesn't redirect to external website

Project description

https://badge.fury.io/py/django-next-url-mixin.svg https://travis-ci.org/PetrDlouhy/django-next-url-mixin.svg?branch=master https://codecov.io/gh/PetrDlouhy/django-next-url-mixin/branch/master/graph/badge.svg

Next url mixin which is safe to phishing attacks

Naive implementation of the next URL mechanism is vulnerable to phishing attacks. This implementation aims to

  1. raise awareness of that

  2. provide safe implementation (possibly seen by more eyes)

The mixin does it’s work in form_valid() function, so it can be used for offspring of FormView or simillar view classes.

Documentation

The full documentation is at https://django-next-url-mixin.readthedocs.io.

Quickstart

Install Django next url mixin:

pip install django-next-url-mixin

Use it in your views:

from django.views.generic.edit import FormView
from next_url_mixin import NextUrlMixin

class MyView(NextUrlMixin, FormView):

    # If you are overriding form_valid(), don't forgot to return the super value with the redirect to the new url
    def form_valid(self, *args, **kwargs):
        return_value = super().form_valid(*args, **kwargs)
        return return_value

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits

Tools used in rendering this package:

History

0.3.0 (2022-03-11)

  • Split mixin into GetNextPageMixin to allow usage of only get_next_page()

0.2.0 (2020-06-22)

  • Fix saving POST form

0.1.0 (2020-06-12)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-next-url-mixin-0.3.0.tar.gz (18.5 kB view details)

Uploaded Source

File details

Details for the file django-next-url-mixin-0.3.0.tar.gz.

File metadata

  • Download URL: django-next-url-mixin-0.3.0.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.7

File hashes

Hashes for django-next-url-mixin-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e1dc887dd754b4c01bf9061a3dc22f20eef825eda0d0f4f245d64a514d95e117
MD5 1e3af880dbf6263522fcfb4177d6b408
BLAKE2b-256 a737bb6d3a39428efb4b6b6a062cafed4ce1c528208037e7b57701a517a1aa65

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page