zwischencommit
This commit is contained in:
parent
35458ab391
commit
cb878d3ed8
|
@ -7,6 +7,7 @@ urlpatterns = [
|
|||
url(r'^$', dncore_views.dashboard, name='dashboard'),
|
||||
|
||||
url(r'^login/$', auth_views.login, name='login'),
|
||||
url(r'^login/$', auth_views.login, name='register'),
|
||||
url(r'^logout/$', auth_views.logout, {'next_page': '/'}, name='logout'),
|
||||
url(r'^profile/$', dncore_views.profile, name='profile'),
|
||||
]
|
||||
|
|
|
@ -7,7 +7,7 @@ def profile(request):
|
|||
|
||||
@login_required
|
||||
def dashboard(request):
|
||||
pass
|
||||
return render(request, "dncore/dashboard.html", {})
|
||||
|
||||
def index(request):
|
||||
return render(request, "index.html", {})
|
||||
|
|
|
@ -22,8 +22,8 @@ import whoisdb.urls
|
|||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', dncore.views.index),
|
||||
url(r'^dashboard/$', dncore.views.dashboard),
|
||||
url(r'^$', dncore.views.index, name='index'),
|
||||
url(r'^dashboard/$', dncore.views.dashboard, name='dashboard'),
|
||||
|
||||
url(r'^admin/', admin.site.urls),
|
||||
url(r'^user/', include(dncore.urls, namespace='user')),
|
||||
|
|
|
@ -35,29 +35,34 @@
|
|||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="{% url "index" %}">Darknet Mgmt</a>
|
||||
<a class="navbar-brand" href="{% url 'index' %}">Darknet Mgmt</a>
|
||||
</div>
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
{% if user.is_authenticated %}
|
||||
<li{% if request.resolver_match.url_name == 'index' %} class="active"{%endif%}><a href="{% url "contest:index" %}">Contest Overview</a></li>
|
||||
<li{% if request.resolver_match.url_name == 'index' %} class="active"{%endif%}><a href="{% url "dashboard" %}">Dashboard</a></li>
|
||||
{% else %}
|
||||
<li{% if request.resolver_match.url_name == 'index' %} class="active"{%endif%}><a href="{% url "index" %}">Home</a></li>
|
||||
{% endif %}
|
||||
<li class="dropdown{% if request.resolver_match.url_name == 'whoisdb' %} active{%endif%}">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Whois DB <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#">Noot</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
{% if user.is_staff %}
|
||||
<li{% if "Ref" in request.resolver_match.url_name %} class="active"{%endif%}><a href="{% url "contest:registerRefs" %}">Register Users</a></li>
|
||||
<li><a href="/admin/">Admin</a></li>
|
||||
{% endif %}
|
||||
{% if user.is_authenticated %}
|
||||
<li><a href="/logout/">Logout</a></li>
|
||||
<li><a href="{% url 'user:logout' %}">Logout</a></li>
|
||||
{% else %}
|
||||
<li{% if request.resolver_match.url_name == 'login' %} class="active"{%endif%}><a href="/login/">Login</a></li>
|
||||
<li{% if request.resolver_match.url_name == 'login' %} class="active"{%endif%}><a href="{% url "user:login" %}">Login</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% if user.is_authenticated %}
|
||||
<p class="navbar-text navbar-right"><a href="{% url "profile" %}"><kbd>{{ user.username }}</kbd></a></p>
|
||||
<p class="navbar-text navbar-right"><a href="{% url "user:profile" %}"><kbd>{{ user.username }}</kbd></a></p>
|
||||
{% endif %}
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Welcome!</div>
|
||||
<div class="panel-body">
|
||||
Here you can manage your darknet resources!
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -10,9 +10,9 @@
|
|||
<div class="panel-heading">Login</div>
|
||||
<div class="panel-body">
|
||||
<p>
|
||||
Don't have an account? <a href="{% url 'register' %}">Register here!</a>
|
||||
Don't have an account? <a href="{% url 'user:register' %}">Register here!</a>
|
||||
</p>
|
||||
<form action="{% url "login" %}" method="post">
|
||||
<form action="{% url "user:login" %}" method="post">
|
||||
{% csrf_token %}
|
||||
{{ form|crispy }}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
Please register with your (uppercase) Callsign as Usernames.
|
||||
For DN-Calls, -[0-9] is allowed.
|
||||
</p>
|
||||
<form method="POST" action="{% url 'register' %}">
|
||||
<form method="POST" action="{% url 'user:register' %}">
|
||||
{% csrf_token %}
|
||||
{{ form|crispy }}
|
||||
<input type="submit" value="Register">
|
||||
|
|
|
@ -1,6 +1,67 @@
|
|||
from django.db import models
|
||||
|
||||
from dncore.models import User
|
||||
from .validators import HandleValidator
|
||||
|
||||
class Maintainer(models.Model):
|
||||
class ExtraFields(models.Model):
|
||||
name = models.CharField(max_length=64)
|
||||
value = models.CharField(max_length=128)
|
||||
|
||||
order = models.PositiveSmallIntegerField()
|
||||
|
||||
class WhoisObject(models.Model):
|
||||
handle_suffix = None
|
||||
whois_fields = None
|
||||
whois_extra_field_names = None
|
||||
|
||||
handle = models.SlugField(max_length='32', unique=True, validators=[HandleValidator()])
|
||||
created = models.DateTimeField(auto_add_now=True)
|
||||
last_modified = models.DateTimeField(auto_add_now=True)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class Maintainer(WhoisObject):
|
||||
auth = models.ManyToManyField(User)
|
||||
|
||||
admin_c = models.ManyToManyField("Contact")
|
||||
|
||||
class MntdObject(WhoisObject):
|
||||
mnt_by = models.ManyToManyField(Maintainer)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
|
||||
class Contact(MntdObject):
|
||||
TYPE = (('person', 'person'), ('role', 'role'))
|
||||
|
||||
name = models.CharField(max_length=128)
|
||||
|
||||
class MntdCObject(MntdObject)
|
||||
admin_c = models.ManyToManyField("Contact")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class MntdObject(WhoisObject):
|
||||
admin_c = models.ManyToManyField(Contact)
|
||||
mnt_by = models
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
|
||||
|
||||
|
||||
class ASNumber(WhoisObject):
|
||||
number = models.PositiveIntegerField(unique=True, db_index=True)
|
||||
|
||||
|
||||
class InetNum(WhoisObject):
|
||||
PROTO = (('ipv4', 'ipv4'), ('ipv6', 'ipv6'))
|
||||
protocol = models.CharField(max_length=4, choices=PROTO)
|
||||
netmask = models.PositiveIntegerField()
|
||||
|
||||
#class ASBlock(WhoisObject):
|
||||
# pass
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
from django.core import validators
|
||||
from django.utils import six
|
||||
from django.utils.deconstruct import deconstructible
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
@deconstructible
|
||||
class HandleValidator(validators.RegexValidator):
|
||||
regex = r'^[A-Z]+[0-9]+(-[A-Z]+)'
|
||||
message = _(
|
||||
'Enter a valid handle (all uppercase)'
|
||||
)
|
||||
flags = re.ASCII if six.PY3 else 0
|
||||
|
Loading…
Reference in New Issue