Merge branch 'master' of github.com:asmaps/nsupdate.info

This commit is contained in:
Thomas Waldmann 2013-09-28 15:29:31 +02:00
commit d6438aeee9
26 changed files with 259 additions and 4 deletions

View File

@ -0,0 +1,28 @@
{% extends "base.html" %}
{% block content %}
<script>
getIp = function(protocol) {
$.getJSON('http://www.ip'+protocol+'.nsupdate.info/myip?callback=?','',function(json_data){
$(".ip"+protocol+"adr").val(json_data.ip);
}).fail(function() {
$(".ip"+protocol+"adr").val("no ip"+protocol+" address found");
});
}
$(document).ready(function() {
getIp('v4');
getIp('v6');
});
</script>
<h1>Overview</h1>
<p>
Ajax request to retrieve the ipv4/ipv6 remote address. The URL www.*.nsupdate.info is used for the call, so this will fail for the dev server. TODO: dev environment
</p>
IPv4: <input type='text' class="form-control ipv4adr" placeholder="loading ip..."> </br >
IPv6: <input type='text' class="form-control ipv6adr" placeholder="loading ip...">
{% endblock %}

View File

@ -1,7 +1,8 @@
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, include, url
from main.views import HomeView, MyIpView from main.views import HomeView, MyIpView, OverviewView
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^$', HomeView.as_view(), name="home"), url(r'^$', HomeView.as_view(), name="home"),
url(r'^overview/', OverviewView.as_view(), name="overview"),
url(r'^myip/', MyIpView) url(r'^myip/', MyIpView)
) )

View File

@ -11,5 +11,14 @@ class HomeView(TemplateView):
context['nav_home'] = True context['nav_home'] = True
return context return context
class OverviewView(TemplateView):
template_name = "main/overview.html"
def get_context_data(self, *args, **kwargs):
context = super(OverviewView, self).get_context_data(*args, **kwargs)
context['nav_overview'] = True
return context
def MyIpView(request): def MyIpView(request):
return HttpResponse(json.dumps({'ip':request.META['REMOTE_ADDR']}), content_type="application/json") return HttpResponse(json.dumps({'ip':request.META['REMOTE_ADDR']}), content_type="application/json")

View File

@ -124,6 +124,8 @@ INSTALLED_APPS = (
'south', 'south',
'nsupdate', 'nsupdate',
'main', 'main',
'bootstrapform',
'registration',
) )
# A sample logging configuration. The only tangible logging # A sample logging configuration. The only tangible logging
@ -154,3 +156,10 @@ LOGGING = {
}, },
} }
} }
ACCOUNT_ACTIVATION_DAYS = 7
try:
from .local_settings import *
except ImportError:
pass

View File

@ -1,3 +1,3 @@
.content { .content {
margin-top: 40px; margin-top: 70px;
} }

View File

@ -11,6 +11,7 @@
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"> <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<link href="{% static 'css/nsupdate.css' %}" rel="stylesheet"> <link href="{% static 'css/nsupdate.css' %}" rel="stylesheet">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head> </head>
<body> <body>
@ -27,6 +28,7 @@
<div class="collapse navbar-collapse"> <div class="collapse navbar-collapse">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li{% if nav_home %} class="active"{% endif %}><a href="{% url 'home' %}">Home</a></li> <li{% if nav_home %} class="active"{% endif %}><a href="{% url 'home' %}">Home</a></li>
<li{% if nav_overview %} class="active"{% endif %}><a href="{% url 'overview' %}">Overview</a></li>
<li{% if nav_about %} class="active"{% endif %}><a href="#about">About</a></li> <li{% if nav_about %} class="active"{% endif %}><a href="#about">About</a></li>
<li{% if nav_contact %} class="active"{% endif %}><a href="#contact">Contact</a></li> <li{% if nav_contact %} class="active"{% endif %}><a href="#contact">Contact</a></li>
</ul> </ul>

View File

@ -0,0 +1,14 @@
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% url 'auth_login' as auth_login_url %}
{% block title %}{% if account %}{% trans "Activation complete" %}{% else %}{% trans "Activation problem" %}{% endif %}{% endblock %}
{% block content %}
{% if account %}
{% blocktrans %}
Thanks {{ account }}, activation complete!
You may now <a href='{{ auth_login_url }}'>login</a> using the username and password you set at registration.
{% endblocktrans %}
{% else %}
{% blocktrans %}Oops &ndash; it seems that your activation key is invalid. Please check the url again.{% endblocktrans %}
{% endif %}
{% endblock %}

View File

@ -0,0 +1,11 @@
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% url 'auth_login' as auth_login_url %}
{% block title %}{% trans "Activation complete" %}{% endblock %}
{% block content %}
{% blocktrans %}
Thanks, activation complete! You may now <a href='{{ auth_login_url }}'>login</a> using the username and password you set at registration.
{% endblocktrans %}
{% endblock %}

View File

@ -0,0 +1,26 @@
{% load i18n %}
{% comment %}
This template is used for the html alternative of the activation email
if you use a django-registration backend that looks for it. e.g.
https://github.com/huseyinyilmaz/django-registration-extended-backend
{% endcomment %}
{% url 'registration_activate' activation_key as activation_key_url %}
{% blocktrans with sitename=site.name sitedomain=site.domain%}<body>
<h3>Account registration for {{ sitename }}</h3>
<p>
You (or someone pretending to be you) have asked to register an account at
<b>{{ sitename }}</b>.<br/>
If this wasn't you, please ignore this email and your address will be removed
from our records.
</p>
<p>
To activate this account, please click the following link within the next
<b>{{ expiration_days }}</b> days:<br/>
<a href="http://{{ sitedomain }}{{ activation_key_url }}">http://{{ sitedomain }}{{ activation_key_url }}</a>
</p>
<p>
Sincerely,<br/>
{{ sitename }} Management
</p>
</body>
{% endblocktrans %}

View File

@ -0,0 +1,15 @@
{% load i18n %}
{% url 'registration_activate' activation_key as activation_key_url%}
{% blocktrans with sitename=site.name siteurl=site.domain %}
You (or someone pretending to be you) have asked to register an account at
{{ sitename }}. If this wasn't you, please ignore this email
and your address will be removed from our records.
To activate this account, please click the following link within the next
{{ expiration_days }} days:
http://{{ siteurl }}{{ activation_key_url }}
Sincerely,
{{ sitename }} Management
{% endblocktrans %}

View File

@ -0,0 +1 @@
{% load i18n %}{% blocktrans with sitename=site.name %}Account registration for {{ sitename }}{% endblocktrans %}

View File

@ -0,0 +1,30 @@
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% url 'auth_password_reset' as auth_pwd_reset_url %}
{% url 'registration_register' as register_url%}
{% block title %}{% trans "Login" %}{% endblock %}
{% block content %}
{% 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 %}
<table>
<tr>
<td>{% trans form.username.label_tag %}</td>
<td>{{ form.username }}</td>
</tr>
<tr>
<td>{% trans form.password.label_tag %}</td>
<td>{{ form.password }}</td>
</tr>
</table>
<p>{% blocktrans %}<a href="{{ auth_pwd_reset_url }}">Forgot</a> your password?
<a href="{{ register_url }}">Need an account</a>?{% endblocktrans %}</p>
<input type="submit" value="{% trans "login" %}" />
<input type="hidden" name="next" value="{{ next }}" />
</form>
{% endblock %}

View File

@ -0,0 +1,6 @@
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Logged out" %}{% endblock %}
{% block content %}
{% trans "Successfully logged out!" %}
{% endblock %}

View File

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

View File

@ -0,0 +1,11 @@
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Change password" %}{% endblock %}
{% block content %}
<form method='post' action=''>{% csrf_token %}
<table>
{{ form }}
<tr><td></td><td><input type='submit' value="{% trans "Change password" %}" /></td></tr>
</table>
</form>
{% endblock %}

View File

@ -0,0 +1,6 @@
{% 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

@ -0,0 +1,12 @@
{% 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

@ -0,0 +1,9 @@
{% 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

@ -0,0 +1,17 @@
{% 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

@ -0,0 +1,13 @@
{% 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

@ -0,0 +1,2 @@
{% extends "base.html" %}
{% load i18n %}

View File

@ -0,0 +1,8 @@
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Activation email sent" %}{% endblock %}
{% block content %}
{% blocktrans %}An activation email has been sent.
Please check your email and click on the link to activate your account.{% endblocktrans %}
{% endblock %}

View File

@ -0,0 +1,11 @@
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% load bootstrap %}
{% block title %}{% trans "Register for an account" %}{% endblock %}
{% block content %}
<h1>Register new account</h1>
<form method='post' action=''>{% csrf_token %}
{{ form|bootstrap }}
<button type="submit" class="btn btn-primary">{% trans "Send activation email" %}</button>
</form>
{% endblock %}

View File

@ -5,6 +5,7 @@ from django.contrib import admin
admin.autodiscover() admin.autodiscover()
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^accounts/', include('registration.backends.default.urls')),
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
url(r'^', include('main.urls')), url(r'^', include('main.urls')),
) )

View File

@ -1,2 +1,4 @@
django==1.5.4 django==1.5.4
south south
django-bootstrap-form
django-registration

View File

@ -17,8 +17,12 @@ setup(
zip_safe=False, zip_safe=False,
platforms='any', platforms='any',
install_requires=[ install_requires=[
'django', 'django<1.6',
'dnspython', 'dnspython',
'south',
'django-bootstrap-form',
'django-registration',
'django-debug-toolbar', #for dev
], ],
classifiers=[ classifiers=[
'Development Status :: 2 - Pre-Alpha', 'Development Status :: 2 - Pre-Alpha',