Merge pull request #126 from elnappo/master

some improvements
This commit is contained in:
ThomasWaldmann 2014-01-15 14:52:27 -08:00
commit bf72818e20
31 changed files with 310 additions and 262 deletions

View File

@ -1,39 +0,0 @@
Django 1.6.x compatibility fix for django-registration (which is, as of 1.0,
not compatible with Django 1.6.x).
taken from https://bitbucket.org/kubaz93/django-registration/branch/django1.6
(merged cs 2251209 and 6e1776d)
diff --git a/registration/auth_urls.py b/registration/auth_urls.py
--- a/registration/auth_urls.py
+++ b/registration/auth_urls.py
@@ -26,6 +26,7 @@
from django.conf.urls import include
from django.conf.urls import patterns
from django.conf.urls import url
+from django.core.urlresolvers import reverse_lazy
from django.contrib.auth import views as auth_views
@@ -41,15 +42,18 @@
name='auth_logout'),
url(r'^password/change/$',
auth_views.password_change,
+ {'post_change_redirect': reverse_lazy('auth_password_change_done')},
name='auth_password_change'),
url(r'^password/change/done/$',
auth_views.password_change_done,
name='auth_password_change_done'),
url(r'^password/reset/$',
auth_views.password_reset,
+ {'post_reset_redirect': reverse_lazy('auth_password_reset_done')},
name='auth_password_reset'),
- url(r'^password/reset/confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
+ url(r'^password/reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
auth_views.password_reset_confirm,
+ {'post_reset_redirect': reverse_lazy('auth_password_reset_complete')},
name='auth_password_reset_confirm'),
url(r'^password/reset/complete/$',
auth_views.password_reset_complete,

View File

@ -1,27 +1,31 @@
{% extends "base.html" %}
{% load i18n %}
{% load bootstrap %}
{% block content %}
<div class="row">
<div class="col-lg-4">
<h1>User Profile of {{ request.user.username }}</h1>
<form method="post" action="">
<div class="col-md-7">
<h2>User Profile of {{ request.user.username }}</h2>
<hr />
<form class="form-horizontal" role="form" method="post">
{% csrf_token %}
{{ form|bootstrap }}
<button type="submit" class="btn btn-primary">Save</button>
{{ form|bootstrap_horizontal:"col-sm-3 col-lg-3" }}
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
<input type="submit" class="btn btn-primary" value="{% trans "Submit" %}" />
</div>
</div>
</form>
</div>
<div class="col-lg-1">
</div>
<div class="col-lg-6">
<h1>Associate with remote Account</h1>
<div class="col-md-5">
<h3>Associate with remote Account</h3>
{% for backend in backends.not_associated %}
<form method="get" action="{% url 'social:begin' backend %}"
style="display: inline-block;">
<button type="submit" class="btn btn-xs btn-success">{{ backend }}</button>
</form>
{% endfor %}
<h1>Deassociate from remote Account</h1>
<h3>Deassociate from remote Account</h3>
{% for socauth in backends.associated %}
<form method="post" action="{% url 'social:disconnect_individual' socauth.provider socauth.pk %}"
style="display: inline-block;">
@ -30,7 +34,5 @@
</form>
{% endfor %}
</div>
<div class="col-lg-1">
</div>
</div>
{% endblock %}

View File

@ -1,48 +0,0 @@
{% extends "registration/registration_base.html" %}
{% load i18n %}{% load bootstrap %}
{% block title %}{% trans "Login" %}{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-5">
<h1>Login with a local Account</h1>
{% if form.errors %}
<p>{% blocktrans %}Your username and password didn't match. Please try again.{% endblocktrans %}</p>
{% endif %}
<form method="post" action="{% url 'auth_login' %}">
{% csrf_token %}
{{ form|bootstrap }}
<div class="form-group">
<input id="id_remember_me" name="remember_me" type="checkbox">
<label class="control-label " for="id_remember_me">Keep me logged in</label>
</div>
<button type="submit" class="btn btn-primary btn-lg">login</button>
<input type="hidden" name="next" value="{{ next }}" />
</form>
<hr>
<h2>Forgot your password?</h2>
<p>
<a class="btn btn-default" href="{% url 'auth_password_reset' %}">Request a password reset</a>
</p>
<h2>Don't have an account yet?</h2>
<p>
<a class="btn btn-default" role="button" href="{% url 'registration_register' %}">Register an account</a>
</p>
</div>
<div class="col-lg-1">
</div>
<div class="col-lg-5">
<h1>Login with a remote Account</h1>
<div class="btn-toolbar" role="toolbar">
{% for backend in backends.backends %}
<div class="btn-group">
<a class="btn btn-default btn-lg" role="button" href="{% url 'social:begin' backend %}">
<i class="fa fa-sign-in fa-fw"></i> {{ backend }}
</a>
</div>
{% endfor %}
</div>
</div>
<div class="col-lg-1">
</div>
</div>
{% endblock %}

View File

@ -1,15 +0,0 @@
{% extends "registration/registration_base.html" %}
{% load i18n %}{% load bootstrap %}
{% block title %}{% trans "Change password" %}{% endblock %}
{% block content %}
<h1>Change password</h1>
<div class="row">
<div class="col-lg-4">
<form method="post" action="">
{% csrf_token %}
{{ form|bootstrap }}
<button type="submit" class="btn btn-primary">{% trans "Change password" %}</button>
</form>
</div>
</div>
{% endblock %}

View File

@ -1,7 +0,0 @@
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Password changed" %}{% endblock %}
{% block content %}
{% trans "Password successfully changed!" %}
{% endblock %}

View File

@ -1,6 +0,0 @@
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Password reset complete" %}{% endblock %}
{% block content %}{% blocktrans %}
Your password has been reset! You may now <a href="{{ login_url }}">log in</a>.
{% endblocktrans %}{% endblock %}

View File

@ -1,12 +0,0 @@
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Confirm password reset" %}{% endblock %}
{% block content %}
{% trans "Enter your new password below to reset your password:" %}
<form method="post" action="">{% csrf_token %}
<table>
{{ form.as_table }}
<tr><td></td><td><input type="submit" value="{% trans "Set password" %}"/></td></tr>
</table>
</form>
{% endblock %}

View File

@ -1,9 +0,0 @@
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Password reset" %}{% endblock %}
{% block content %}
<p>
{% blocktrans %}We have sent you an email with a link to reset your password.
Please check your email and click the link to continue.{% endblocktrans %}
</p>
{% endblock %}

View File

@ -1,17 +0,0 @@
{% load i18n %}{% trans "Greetings" %} {% if user.get_full_name %}{{ user.get_full_name }}{% else %}{{ user }}{% endif %},
{% blocktrans %}You are receiving this email because you (or someone pretending to be you)
requested that your password be reset on the {{ domain }} site. If you do not
wish to reset your password, please ignore this message.
To reset your password, please click the following link, or copy and paste it
into your web browser:{% endblocktrans %}
{{ protocol }}://{{ domain }}{% url 'auth_password_reset_confirm' uid token %}
{% blocktrans with username=user.username %}
Your username, in case you've forgotten: {{ username }}
Best regards,
{{ site_name }} Management
{% endblocktrans %}

View File

@ -1,13 +0,0 @@
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Reset password" %}{% endblock %}
{% block content %}{% blocktrans %}
Forgot your password? Enter your email in the form below and we'll send you
instructions for creating a new one.{% endblocktrans %}
<form method='post' action=''>{% csrf_token %}
<table>
{{ form }}
<tr><td></td><td><input type='submit' value="{% trans "Reset password" %}" /></td></tr>
</table>
</form>
{% endblock %}

View File

@ -4,7 +4,7 @@
{% block title %}{% trans "Register for an account" %}{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-5">
<div class="col-md-6">
<h2>No registration required for testing</h2>
<p>
You can easily test the service and see what you get.
@ -31,9 +31,7 @@
finishing your initial evaluation.
</p>
</div>
<div class="col-lg-1">
</div>
<div class="col-lg-6">
<div class="col-md-6">
<h2>Register new account</h2>
<p>
Username: should be related to your <em>person or organisation</em>
@ -41,9 +39,14 @@
E-Mail address: must be a <em>working</em> one, we'll send you an activation E-Mail there.<br>
Password: please use a sane one, we trust you.
</p>
<form method='post' action=''>{% csrf_token %}
{{ form|bootstrap }}
<button type="submit" class="btn btn-primary">{% trans "Send activation email" %}</button>
<form class="form-horizontal" role="form" method="post" action="">
{% csrf_token %}
{{ form|bootstrap_horizontal }}
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="submit" class="btn btn-primary" value="{% trans "Send activation email" %}" />
</div>
</div>
</form>
</div>
</div>

View File

@ -1,4 +1,9 @@
from django.conf.urls import patterns, url
from django.conf.urls import patterns
from django.conf.urls import url
from django.views.generic.base import TemplateView
from registration.backends.default.views import ActivationView
from registration.backends.default.views import RegistrationView
from .views import UserProfileView
@ -6,4 +11,23 @@ from .views import UserProfileView
urlpatterns = patterns(
'',
url(r'^profile/', UserProfileView.as_view(), name="account_profile"),
# registration start
url(r'^activate/complete/$',
TemplateView.as_view(template_name='registration/activation_complete.html'),
name='registration_activation_complete'),
# Activation keys get matched by \w+ instead of the more specific
# [a-fA-F0-9]{40} because a bad activation key should still get to the view;
# that way it can return a sensible "invalid key" message instead of a
# confusing 404.
url(r'^activate/(?P<activation_key>\w+)/$',
ActivationView.as_view(),
name='registration_activate'),
url(r'^register/$',
RegistrationView.as_view(),
name='registration_register'),
url(r'^register/complete/$',
TemplateView.as_view(template_name='registration/registration_complete.html'),
name='registration_complete'),
# registration end
)

View File

View File

@ -0,0 +1,49 @@
{% extends "base.html" %}
{% load i18n %}{% load bootstrap %}
{% block title %}{% trans "Login" %}{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-6">
<h2>{% trans "Login with a local Account" %}</h2>
<hr />
{% if form.errors %}
<p>{% blocktrans %}Your username and password didn't match. Please try again.{% endblocktrans %}</p>
{% endif %}
<form class="form-horizontal" role="form" method="post" action="{% url 'django.contrib.auth.views.login' %}">
{% csrf_token %}
{{ form|bootstrap_horizontal }}
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input id="id_remember_me" name="remember_me" type="checkbox">
<label class="control-label " for="id_remember_me">{% trans "Remember me" %}</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="submit" class="btn btn-primary" value="{% trans 'Log in' %}" />
<a href="{% url 'registration_register' %}"><button class="btn btn-default" type="button">{% trans "Sign up" %}</button></a>
<p></p>
<p><a href="{% url 'django.contrib.auth.views.password_reset' %}">{% trans 'Forgot your password?' %}</a></p>
</div>
</div>
</form>
</div>
<div class="col-md-6">
<h2>{% trans "Login with a remote Account" %}</h2>
<hr />
<div class="btn-toolbar" role="toolbar">
{% for backend in backends.backends %}
<div class="btn-group">
<a class="btn btn-default" role="button" href="{% url 'social:begin' backend %}">
<i class="fa fa-sign-in fa-fw"></i> {{ backend }}
</a>
</div>
{% endfor %}
</div>
</div>
</div>
<script type="text/javascript">document.getElementById("id_username").focus();</script>
{% endblock %}

View File

@ -0,0 +1,11 @@
{% extends "base.html" %}
{% load i18n %}{% load bootstrap %}
{% block title %}{% trans "Login" %}{% endblock %}
{% block content %}
<div class="container">
<div class="form-signin">
<p>{% trans "Thanks for spending some quality time with the Web site today." %}</p>
<p><a href="{% url 'django.contrib.auth.views.login' %}">{% trans 'Log in again' %}</a></p>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,21 @@
{% extends "registration/registration_base.html" %}
{% load i18n %}{% load bootstrap %}
{% block title %}{% trans 'Password change' %}{% endblock %}
{% block content %}
<h2>{% trans 'Password change' %}</h2>
<hr />
<p>{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}</p>
<div class="col-md-7">
<form class="form-horizontal" role="form" method="post">
{% csrf_token %}
{{ form|bootstrap_horizontal:"col-sm-4 col-lg-4" }}
<div class="form-group">
<div class="col-sm-offset-4 col-sm-8">
<input type="submit" class="btn btn-primary" value="{% trans 'Change my password' %}" />
</div>
</div>
</form>
</div>
<script type="text/javascript">document.getElementById("id_old_password").focus();</script>
{% endblock %}

View File

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans 'Password change successful' %}{% endblock %}
{% block content %}
<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<h4>{% trans 'Password change successful' %}</h4>
{% trans 'Your password was changed.' %}
</div>{% endblock %}

View File

@ -0,0 +1,26 @@
{% extends "base.html" %}
{% load i18n %}{% load bootstrap %}
{% block title %}% trans "Password reset" %}{% endblock %}
{% block content %}
<div class="row">
<h2>{% trans "Password reset" %}</h2>
<hr />
<p>{% trans "Forgotten your password? Enter your email address below, and we'll email instructions for setting a new one." %}</p>
<div class="col-md-6">
<form class="form-horizontal" role="form" method="post">
{% csrf_token %}
{{ form|bootstrap_horizontal }}
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="submit" class="btn btn-primary" value="{% trans 'Reset my password' %}" />
</div>
</div>
</form>
</div>
</div>
<script type="text/javascript">document.getElementById("id_email").focus();</script>
{% endblock %}

View File

@ -0,0 +1,11 @@
{% extends "base.html" %}
{% load i18n %}{% load bootstrap %}
{% block title %}{% trans 'Password reset complete' %}{% endblock %}
{% block content %}
<h2>{% trans 'Password reset complete' %}</h2>
<p>{% trans "Your password has been set. You may go ahead and log in now." %}</p>
<p><a href="{{ login_url }}"><button class="btn btn-primary" type="button">{% trans "Log in" %}</button></a></p>
{% endblock %}

View File

@ -0,0 +1,31 @@
{% extends "base.html" %}
{% load i18n %}{% load bootstrap %}
{% block title %}{% trans 'Password reset' %}{% endblock %}
{% block content %}
{% if validlink %}
<h2>{% trans 'Enter new password' %}</h2>
<p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p>
<form class="form-horizontal" role="form" method="post">
{% csrf_token %}
{{ form|bootstrap_horizontal }}
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="submit" class="btn btn-primary" value="{% trans 'Change my password' %}" />
</div>
</div>
</form>
<script type="text/javascript">document.getElementById("id_new_password1").focus();</script>
{% else %}
<h2>{% trans 'Password reset unsuccessful' %}</h2>
<p>{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,11 @@
{% extends "base.html" %}
{% load i18n %}{% load bootstrap %}
{% block title %}{% trans 'Password reset successful' %}{% endblock %}
{% block content %}
<h2>{% trans 'Password reset successful' %}</h2>
<p>{% trans "We've emailed you instructions for setting your password. You should be receiving them shortly." %}</p>
<p>{% trans "If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder." %}</p>
{% endblock %}

27
nsupdate/login/urls.py Normal file
View File

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
urlpatterns = patterns(
'',
# login and logout url
url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}, name='login'),
# or use 'django.contrib.auth.views.logout' with template 'logout.html
url(r'^logout/$', 'django.contrib.auth.views.logout_then_login', name='logout'),
# password reset urls
url(r'^password_reset/$', 'django.contrib.auth.views.password_reset',
{'template_name': 'password_reset.html'}, name='password_reset'),
url(r'^password_reset_done/$', 'django.contrib.auth.views.password_reset_done',
{'template_name': 'password_reset_done.html'}, name='password_reset_done'),
url(r'^password_reset_confirm/(?P<uidb36>[0-9A-Za-z]{1,13})-(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
'django.contrib.auth.views.password_reset_confirm',
{'template_name': 'password_reset_confirm.html'}, name='password_reset_confirm'),
url(r'^password_reset_complete/$', 'django.contrib.auth.views.password_reset_complete',
{'template_name': 'password_reset_complete.html'}, name='password_reset_complete'),
# password change urls
url(r'^password_change/$', 'django.contrib.auth.views.password_change',
{'template_name': 'password_change.html'}, name='password_change'),
url(r'^password_change_done/$', 'django.contrib.auth.views.password_change_done',
{'template_name': 'password_change_done.html'}, name='password_change_done'),
)

View File

@ -6,8 +6,24 @@ from django.contrib import admin
from .models import Host, Domain, BlacklistedDomain, ServiceUpdater, ServiceUpdaterHostConfig
admin.site.register(BlacklistedDomain)
admin.site.register(Domain)
admin.site.register(Host)
class DomainAdmin(admin.ModelAdmin):
list_display = ("domain", "public", "available", "created_by")
list_filter = ("public", "available", "created_by")
class HostAdmin(admin.ModelAdmin):
list_display = ("subdomain", "domain", "abuse_blocked")
list_filter = ("domain", "created_by", "abuse", "abuse_blocked")
class BlacklistedDomainAdmin(admin.ModelAdmin):
list_display = ("domain", "created_by")
list_filter = ("created_by", "created")
admin.site.register(BlacklistedDomain, BlacklistedDomainAdmin)
admin.site.register(Domain, DomainAdmin)
admin.site.register(Host, HostAdmin)
admin.site.register(ServiceUpdater)
admin.site.register(ServiceUpdaterHostConfig)

View File

@ -4,7 +4,7 @@
{% block content %}
<div class="row">
<h3>{{ domain.domain }} <br><small><a href="{% url 'domain_overview' %}"><i class="fa fa-angle-double-left"></i> back to overview</a></small></h3>
<div class="col-lg-8">
<div class="col-md-8">
<h3>Edit Domain</h3>
<p>You can't change the domain name. If you want to have another domain name, you have to delete this domain and create a new one.</p>
<p>
@ -17,7 +17,7 @@
<button type="submit" class="btn btn-primary">Update</button>
</form>
</div>
<div class="col-lg-4">
<div class="col-md-4">
<h3>Show Configuration</h3>
<p>
We'll generate a ready-to-use configuration for your name server,

View File

@ -3,7 +3,7 @@
{% block content %}
<div class="row">
<div class="col-lg-12">
<div class="col-md-12">
<h3>Domains (yours first, then public)</h3>
<table class="table">
<thead>
@ -43,7 +43,7 @@
<hr>
<div class="row">
<div class="col-lg-6">
<div class="col-md-6">
<div class="well well-sm">
<h3>Add a new Domain</h3>
<form method="post" action="">
@ -53,7 +53,7 @@
</form>
</div>
</div>
<div class="col-lg-6">
<div class="col-md-6">
<div class="well well-sm">
<h3>Help</h3>
<p>

View File

@ -4,7 +4,7 @@
{% block content %}
<div class="row">
<h3>{{ host.get_fqdn }} <br><small><a href="{% url 'overview' %}"><i class="fa fa-angle-double-left"></i> back to overview</a></small></h3>
<div class="col-lg-4">
<div class="col-md-4">
<h3>Edit Host</h3>
<form method="post" action="">
{% csrf_token %}
@ -19,7 +19,7 @@
<button type="submit" class="btn btn-primary btn-danger">Delete host</button>
</form>
</div>
<div class="col-lg-4">
<div class="col-md-4">
<h3>Show Configuration</h3>
<p>
We'll generate a ready-to-use configuration for your router / update
@ -38,7 +38,7 @@
<button type="submit" class="btn btn-primary">Configure Updaters</button>
</form>
</div>
<div class="col-lg-4">
<div class="col-md-4">
<h3>Update Nameserver Entry</h3>
<p>Usually you configure your router to follow the dyndns2 protocol.
But if you know what you are doing, and you want to update it manually, you can do it here.

View File

@ -3,7 +3,7 @@
{% block content %}
<div class="row">
<div class="col-lg-12">
<div class="col-md-12">
<h3>Your Hosts</h3>
<table class="table">
<thead>
@ -21,8 +21,20 @@
<td><a href="{% url 'host_view' host.pk %}"><b>{{ host.subdomain }}.{{ host.domain.domain }}</b></a></td>
<td>{{ host.available|yesno }}</td>
<td>C: {{ host.client_faults }} S: {{ host.server_faults }}{% if host.abuse_blocked %} ABUSE-BLOCKED{% elif host.abuse %} ABUSE{% endif %}</td>
<td>{{ host.get_ipv4 }} ({{ host.last_update_ipv4|timesince }}, {% if not host.ssl_update_ipv4 %}no {% endif %}SSL)</td>
<td>{{ host.get_ipv6 }} ({{ host.last_update_ipv6|timesince }}, {% if not host.ssl_update_ipv6 %}no {% endif %}SSL)</td>
<td>
{% if host.get_ipv4 %}
{{ host.get_ipv4 }} ({{ host.last_update_ipv4|timesince }}, {% if not host.ssl_update_ipv4 %}<span class="label label-warning">no{% else %}<span class="label label-success">{% endif %} SSL</span>)
{% else %}
None
{% endif %}
</td>
<td>
{% if host.get_ipv6 %}
{{ host.get_ipv6 }} ({{ host.last_update_ipv6|timesince }}, {% if not host.ssl_update_ipv6 %}<span class="label label-warning">no{% else %}<span class="label label-success">{% endif %} SSL</span>)
{% else %}
None
{% endif %}
</td>
<td>{{ host.comment }}</td>
</tr>
{% empty %}
@ -34,7 +46,7 @@
<hr>
<div class="row">
<div class="col-lg-4">
<div class="col-md-4">
<div class="well well-sm">
<h3>Create a new Host</h3>
<form method="post" action="">
@ -44,7 +56,7 @@
</form>
</div>
</div>
<div class="col-lg-8">
<div class="col-md-8">
<div class="well well-sm">
<h3>Help</h3>
<p>Here you can add new hosts (like routers, PCs, servers, ...).

View File

@ -3,7 +3,7 @@
{% block content %}
<div class="row">
<div class="col-lg-4">
<div class="col-md-4">
<h3>Domains</h3>
<dl>
<dt>Total:</dt>
@ -14,7 +14,7 @@
<dd>{{ domains_unavailable }}</dd>
</dl>
</div>
<div class="col-lg-4">
<div class="col-md-4">
<h3>Hosts</h3>
<dl>
<dt>Total:</dt>
@ -31,7 +31,7 @@
<dd>{{ hosts_ipv4_2y }} ({{ hosts_ipv4_ssl_2y }}) / {{ hosts_ipv6_2y }} ({{ hosts_ipv6_ssl_2y }})</dd>
</dl>
</div>
<div class="col-lg-4">
<div class="col-md-4">
<h3>Users</h3>
<dl>
<dt>Total:</dt>

View File

@ -148,6 +148,7 @@ INSTALLED_APPS = (
'django.contrib.messages',
'django.contrib.staticfiles',
'social.apps.django_app.default',
'nsupdate.login',
'south',
'nsupdate',
'nsupdate.accounts',

View File

@ -1,4 +1,5 @@
{% load static from staticfiles %}
{% load i18n %}
<!DOCTYPE html>
<html lang="en">
<head>
@ -13,7 +14,6 @@
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet">
<link href="{% static 'css/nsupdate.css' %}" rel="stylesheet">
<link rel="icon" type="image/png" href="{% static 'favicon.png' %}" />
<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
{% include "includes/base_head.html" %}
{% block html_head %}{% endblock %}
</head>
@ -32,41 +32,41 @@
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li{% if nav_home %} class="active"{% endif %}>
<a href="{% url 'home' %}"><i class="fa fa-home fa-fw"></i> Home</a>
<a href="{% url 'home' %}"><i class="fa fa-home fa-fw"></i> {% trans "Home" %}</a>
</li>
{% if request.user.is_authenticated %}
<li{% if nav_overview %} class="active"{% endif %}>
<a href="{% url 'overview' %}"><i class="fa fa-list fa-fw"></i> Hosts</a>
<a href="{% url 'overview' %}"><i class="fa fa-list fa-fw"></i> {% trans "Hosts" %}</a>
</li>
<li{% if nav_domain_overview %} class="active"{% endif %}>
<a href="{% url 'domain_overview' %}"><i class="fa fa-list fa-fw"></i> Domains</a>
<a href="{% url 'domain_overview' %}"><i class="fa fa-list fa-fw"></i> {% trans "Domains" %}</a>
</li>
<li{% if nav_status %} class="active"{% endif %}>
<a href="{% url 'status' %}"><i class="fa fa-list fa-fw"></i> Status</a>
<a href="{% url 'status' %}"><i class="fa fa-list fa-fw"></i> {% trans "Status" %}</a>
</li>
{% endif %}
<li{% if nav_about %} class="active"{% endif %}>
<a href="{% url 'about' %}"><i class="fa fa-comment fa-fw"></i> About</a>
<a href="{% url 'about' %}"><i class="fa fa-comment fa-fw"></i> {% trans "About" %}</a>
</li>
<li>
<a href="http://nsupdateinfo.readthedocs.org/"
class="navbar-link" title="Open docs in new window" target="_blank"><i class="fa fa-eye fa-fw"></i> Documentation</a>
class="navbar-link" title="Open docs in new window" target="_blank"><i class="fa fa-eye fa-fw"></i> {% trans "Documentation" %}</a>
</li>
</ul>
<ul class="nav navbar-nav pull-right">
{% if not request.user.is_authenticated %}
<li{% if nav_register %} class="active"{% endif %}><a href="{% url 'registration_register' %}"><i class="fa fa-asterisk fa-fw"></i> Register</a></li>
<li{% if nav_login %} class="active"{% endif %}><a href="{% url 'auth_login' %}"><i class="fa fa-sign-in fa-fw"></i> Login</a></li>
<li{% if nav_register %} class="active"{% endif %}><a href="{% url 'registration_register' %}"><i class="fa fa-asterisk fa-fw"></i> {% trans "Sign up" %}</a></li>
<li{% if nav_login %} class="active"{% endif %}><a href="{% url 'django.contrib.auth.views.login' %}"><i class="fa fa-sign-in fa-fw"></i> {% trans 'Log in' %}</a></li>
{% else %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user fa-fw"></i> {{ request.user.username }} <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{% url 'account_profile' %}"><i class="fa fa-cogs fa-fw"></i> Profile</a></li>
<li><a href="{% url 'auth_password_change' %}"><i class="fa fa-key fa-fw"></i> Change password</a></li>
<li><a href="{% url 'account_profile' %}"><i class="fa fa-cogs fa-fw"></i> {% trans 'Profile' %}</a></li>
<li><a href="{% url 'django.contrib.auth.views.password_change' %}"><i class="fa fa-key fa-fw"></i> {% trans 'Password change' %}</a></li>
{% if request.user.is_staff %}
<li><a href="/admin/"><i class="fa fa-wrench fa-fw"></i> Admin</a></li>
<li><a href="{% url 'admin:index' %}"><i class="fa fa-wrench fa-fw"></i> {% trans 'Admin interface' %}</a></li>
{% endif %}
<li><a href="{% url 'auth_logout' %}?next={% url 'auth_login' %}"><i class="fa fa-sign-out fa-fw"></i> Logout</a></li>
<li><a href="{% url 'django.contrib.auth.views.logout_then_login' %}"><i class="fa fa-sign-out fa-fw"></i> {% trans 'Logout' %}</a></li>
</ul>
</li>
{% endif %}
@ -119,6 +119,7 @@
{% include "includes/base_footer.html" %}
</div>
</div>
<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<div id="ip_detection" style="display: none">
{% comment %}

View File

@ -5,7 +5,6 @@ top-level url dispatching
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm
from django.contrib.auth import views as auth_views
admin.autodiscover()
@ -26,52 +25,11 @@ def remember_me_login(request, *args, **kw):
return auth_views.login(request, *args, **kw)
class Html5RegistrationForm(RegistrationForm):
def __init__(self, *args, **kwargs):
super(Html5RegistrationForm, self).__init__(*args, **kwargs)
self.fields['username'].widget.attrs.update(dict(autofocus=None))
class Html5AuthenticationForm(AuthenticationForm):
def __init__(self, *args, **kwargs):
super(Html5AuthenticationForm, self).__init__(*args, **kwargs)
self.fields['username'].widget.attrs.update(dict(autofocus=None))
class Html5PasswordChangeForm(PasswordChangeForm):
def __init__(self, *args, **kwargs):
super(Html5PasswordChangeForm, self).__init__(*args, **kwargs)
self.fields['old_password'].widget.attrs.update(dict(autofocus=None))
urlpatterns = patterns(
'',
url('', include('social.apps.django_app.urls', namespace='social')),
# registration start
# these are some modified patterns from registration.backends.default.urls:
url(r'^accounts/register/$',
RegistrationView.as_view(form_class=Html5RegistrationForm),
name='registration_register'),
# from registration.auth_urls:
url(r'^accounts/login/$',
remember_me_login,
{'authentication_form': Html5AuthenticationForm,
'template_name': 'registration/login.html'},
name='auth_login'),
url(r'^accounts/password/change/$',
auth_views.password_change,
{'password_change_form': Html5PasswordChangeForm,
'template_name': 'registration/password_change.html', # own template
'post_change_redirect': '/account/profile'}, # reverse() does not work here
name='auth_password_change'),
#url(r'^accounts/password/reset/$',
# auth_views.password_reset,
# name='auth_password_reset'),
#url(r'^accounts/password/reset/done/$',
# auth_views.password_reset,
# name='password_reset_done'),
url(r'^accounts/', include('registration.backends.default.urls')),
# registration end
url(r'^accounts/', include('nsupdate.login.urls')),
# registration and user settings
url(r'^account/', include('nsupdate.accounts.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('nsupdate.main.urls')),