add missing files to the example app
This commit is contained in:
parent
be337d6017
commit
414d787680
|
@ -0,0 +1,8 @@
|
|||
from django import forms
|
||||
|
||||
|
||||
class SimpleSignUpForm(forms.Form):
|
||||
username = forms.CharField()
|
||||
challenge = forms.CharField()
|
||||
address = forms.CharField()
|
||||
signature = forms.CharField()
|
|
@ -2,7 +2,7 @@
|
|||
from django.contrib.auth.views import LoginView
|
||||
from django.views.generic import FormView
|
||||
|
||||
from .models import Address
|
||||
from .forms import SimpleSignUpForm
|
||||
|
||||
|
||||
class MoneroLoginView(LoginView):
|
||||
|
@ -10,4 +10,5 @@ class MoneroLoginView(LoginView):
|
|||
|
||||
|
||||
class MoneroSignUpView(FormView):
|
||||
pass
|
||||
template_name = "registration/signup.html"
|
||||
form_class = SimpleSignUpForm
|
||||
|
|
|
@ -16,9 +16,12 @@ Including another URLconf
|
|||
from django.conf.urls import url, include
|
||||
from django.contrib import admin
|
||||
|
||||
from testauth.views import IndexView
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(r"^admin/", admin.site.urls),
|
||||
url(r"", include("django_cryptolock.urls", namespace="django_cryptolock")),
|
||||
url(r"^auth/", include("testauth.urls")),
|
||||
url(r"^$", IndexView.as_view(), name="index"),
|
||||
]
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
{% extends 'django_cryptolock/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
{% if request.user.is_authenticated %}
|
||||
<h1>Hello {{request.user.username}}</h1>
|
||||
<p>Here are your details:</p>
|
||||
<ul>
|
||||
<li>...</li>
|
||||
<li>...</li>
|
||||
<li>...</li>
|
||||
</ul>
|
||||
<form method="post" action="{% url 'test_logout' %}">
|
||||
<input type="submit" value="Logout" />
|
||||
</form>
|
||||
{% else %}
|
||||
<h1>Hey stranger</h1>
|
||||
<p>This website is an example of the "django_cryptolock" package.</p>
|
||||
<p>
|
||||
It lets you (and your users) use your monero wallet to login on your
|
||||
website. You just need to sign the challenge that is provided to you.
|
||||
</p>
|
||||
<p>Go ahead and try it.</p>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
|
@ -1,5 +1,8 @@
|
|||
{% extends 'django_cryptolock/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
{{form}}
|
||||
<form>
|
||||
{{form}}
|
||||
<input type="submit" value="Login" />
|
||||
</form>
|
||||
{% endblock content %}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
{% extends 'django_cryptolock/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<form>
|
||||
{{form}}
|
||||
<input type="submit" value="Sign Up" />
|
||||
</form>
|
||||
{% endblock content %}
|
|
@ -2,4 +2,4 @@ from django.apps import AppConfig
|
|||
|
||||
|
||||
class TestauthConfig(AppConfig):
|
||||
name = 'testauth'
|
||||
name = "testauth"
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
from django.conf.urls import url
|
||||
from django.contrib.auth.views import LogoutView
|
||||
|
||||
from .views import TestLoginView, TestSignupView
|
||||
from django_cryptolock.views import MoneroLoginView, MoneroSignUpView
|
||||
|
||||
urlpatterns = [
|
||||
url(r"login", TestLoginView.as_view(), name="test_login"),
|
||||
url(r"signup", TestSignupView.as_view(), name="test_signup"),
|
||||
url(r"login", MoneroLoginView.as_view(), name="test_login"),
|
||||
url(r"signup", MoneroSignUpView.as_view(), name="test_signup"),
|
||||
url(r"logout", LogoutView.as_view(), name="test_logout"),
|
||||
]
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
from django.shortcuts import render
|
||||
from django_cryptolock.views import MoneroLoginView, MoneroSignUpView
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
|
||||
class TestLoginView(MoneroLoginView):
|
||||
pass
|
||||
|
||||
|
||||
class TestSignupView(MoneroSignUpView):
|
||||
pass
|
||||
class IndexView(TemplateView):
|
||||
template_name = "index.html"
|
||||
|
|
Loading…
Reference in New Issue