Django tool for create ont time links
Installation
For integrate with Django need to add ua2.otl to the list of installed app:
INSTALLED_APPS += (
'ua2.otl')
and put into a root urls.py next line:
url(r'^l/', include('ua2.otl.urls'))
Be warning: include urls.py only compatibil with Django >= 1.8. For django before 1.8 need use following solution:
from ua2.otl.views import otl_view
urlpatterns = urlpatterns(
.....
url(r'^l/(?P<otp_key>\w+)/$', otl_view, name='one-time-link'),
)
Using
You can use OneTimeLink with several scenario:
redirect to view with django backresolve (with support callback)
redirect to direct URL (with support callback)
using view to redner response
Redirects
There are two way to pass resulted link to OneTimeLink object:
pass url resolve point with kwargs
pass rendered link
from ua2.otl import OneTimeLink
link = OneTimeLink.create(resolve_name='django-url-name', resolve_kwargs={'value': 1})
link.save(expire=3600)
Example with callback and authorization:
from ua2.otl import OntTimeLink
def auth_callback(request, user_email):
user = get_object_or_404(User,
email=user_email)
login(request, user)
@login_required
def password_restore(request):
....
def send_restore_passwortd(request):
link = OneTimeLink.create(resolve_name='url-password-reset')
link['user_email'] = request.POST.get('user_email')
link.save(callback=auth_callback,
expire=3600,
count=1)
return HttpResponse("http://127.0.0.1:8000%s" % link.url)
Metadata
Release files for ua2.otl 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ua2.otl-0.0.5.tar.gz | 4.5 kB | Without provenance | Details |
Release files / ua2.otl-0.0.5.tar.gz
| Download URL | ua2.otl-0.0.5.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
353559d604b509a2709f03b347cde018e8ab7d80be334260748734e0960e0d90
|
|
BLAKE2b-256 checksum How to use checksums |
52debf869a932269f228ff35a7a8958e05c1a53f8c77bedfefb464210949a0be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.8 CPython/2.7.16
|
Security for ua2.otl 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.