diff --git a/www/maposmatic/forms.py b/www/maposmatic/forms.py
index 13670b44..87f57873 100644
--- a/www/maposmatic/forms.py
+++ b/www/maposmatic/forms.py
@@ -30,6 +30,8 @@ from django.utils.safestring import mark_safe
from django.utils.html import escape
from django.utils.translation import ugettext_lazy as _
from django.forms.utils import ErrorList
+from django.contrib.auth.forms import UserCreationForm
+
import time
import ocitysmap
@@ -334,3 +336,8 @@ class MapCancelForm(forms.Form):
cleaned_data["id"] = 0
return cleaned_data
+
+class CustomUserCreationForm(UserCreationForm):
+ class Meta(UserCreationForm.Meta):
+# fields = UserCreationForm.Meta.fields + ("email",)
+ pass
diff --git a/www/maposmatic/templates/maposmatic/base-parts/navbar.html b/www/maposmatic/templates/maposmatic/base-parts/navbar.html
index 23841233..d62aa3b9 100644
--- a/www/maposmatic/templates/maposmatic/base-parts/navbar.html
+++ b/www/maposmatic/templates/maposmatic/base-parts/navbar.html
@@ -72,6 +72,14 @@
{% endif %}
{% endif %}
+
+ {% if user.is_authenticated %}
+ {%trans "Logout" %}
+ {% else %}
+ {%trans "Login" %}
+ {% endif %}
+
+
+
diff --git a/www/maposmatic/views.py b/www/maposmatic/views.py
index b3a0284a..a349f3cc 100644
--- a/www/maposmatic/views.py
+++ b/www/maposmatic/views.py
@@ -34,7 +34,7 @@ from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.urls import reverse
from django.http import HttpResponseRedirect, HttpResponseBadRequest, HttpResponseNotFound, HttpResponse, Http404
from django.db.transaction import TransactionManagementError
-from django.shortcuts import get_object_or_404, render_to_response, render
+from django.shortcuts import get_object_or_404, render_to_response, render, redirect
from django.template import RequestContext
from django.utils.translation import ugettext, ugettext_lazy as _
from django.core import serializers
@@ -43,6 +43,9 @@ from django.core.exceptions import ValidationError
from django.urls import get_script_prefix
from django.db import connections
from django.utils.safestring import mark_safe
+from django.urls import reverse
+
+from www.maposmatic.forms import CustomUserCreationForm
import ocitysmap
from www.maposmatic import helpers, forms, nominatim, models
@@ -658,3 +661,17 @@ def api_rendering_status(request, id, nonce=None):
def dashboard(request):
return render(request, "users/dashboard.html")
+
+def register(request):
+ if request.method == "GET":
+ return render(
+ request, "users/register.html",
+ {"form": CustomUserCreationForm}
+ )
+ elif request.method == "POST":
+ form = CustomUserCreationForm(request.POST)
+ if form.is_valid():
+ user = form.save()
+ login(request, user)
+ return redirect(reverse("dashboard"))
+
diff --git a/www/static/css/maposmatic.css b/www/static/css/maposmatic.css
index 929adac8..17ee5749 100644
--- a/www/static/css/maposmatic.css
+++ b/www/static/css/maposmatic.css
@@ -325,3 +325,12 @@ a.carousel-control { display: none; }
letter-spacing: -2px; vertical-align: top; z-index: 999;
}
+
+
+* > .fa-hover-show,
+*:hover > .fa-hover-hidden {
+ display: none;
+}
+*:hover > .fa-hover-show {
+ display: inline-block;
+}
diff --git a/www/templates/registration/login.html b/www/templates/registration/login.html
index 8548768c..1c6de215 100644
--- a/www/templates/registration/login.html
+++ b/www/templates/registration/login.html
@@ -14,5 +14,5 @@
-Back to dashboard
-{% endblock %}
\ No newline at end of file
+Register
+{% endblock %}
diff --git a/www/templates/users/register.html b/www/templates/users/register.html
new file mode 100644
index 00000000..7bdf7d24
--- /dev/null
+++ b/www/templates/users/register.html
@@ -0,0 +1,18 @@
+{% extends "maposmatic/base.html" %}
+
+{% load i18n %}
+{% load l10n %}
+{% load extratags %}
+
+{% block title %}Registration{% endblock %}
+{% block page %}
+Register
+
+
+
+Back to login
+{% endblock %}
diff --git a/www/urls.py b/www/urls.py
index 5e77ac88..c25ae63f 100644
--- a/www/urls.py
+++ b/www/urls.py
@@ -136,6 +136,7 @@ urlpatterns = [
# user management
url(r"^accounts/", include("django.contrib.auth.urls")),
url(r"^dashboard/", views.dashboard, name="dashboard"),
+ url(r"^register/", views.register, name="register"),
# test
url(r'heatmap/', TemplateView.as_view(template_name='heatmap.html', content_type='text/html')),