diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml index 507b0ad..8934729 100644 --- a/.idea/dataSources.xml +++ b/.idea/dataSources.xml @@ -1,22 +1,11 @@ - + sqlite.xerial true org.sqlite.JDBC - jdbc:sqlite:$PROJECT_DIR$/db.sqlite3 - - - - - - file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.25.1/sqlite-jdbc-3.25.1.jar - - - file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.25.1/license.txt - - + jdbc:sqlite:$PROJECT_DIR$/data/db.sqlite3 \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index ad2d41e..08beb51 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/bookmarks/styles/login.scss b/bookmarks/styles/auth.scss similarity index 84% rename from bookmarks/styles/login.scss rename to bookmarks/styles/auth.scss index e4d04b3..e2ff6b6 100644 --- a/bookmarks/styles/login.scss +++ b/bookmarks/styles/auth.scss @@ -1,4 +1,4 @@ -.login-page { +.auth-page { > .columns { align-items: center; justify-content: center; diff --git a/bookmarks/styles/index.scss b/bookmarks/styles/index.scss index b86c22e..8797384 100644 --- a/bookmarks/styles/index.scss +++ b/bookmarks/styles/index.scss @@ -23,4 +23,4 @@ $alternative-color-dark: darken($alternative-color, 5%); @import "shared"; @import "bookmarks"; @import "settings"; -@import "login"; +@import "auth"; diff --git a/bookmarks/templates/django_registration/registration_complete.html b/bookmarks/templates/django_registration/registration_complete.html new file mode 100644 index 0000000..dfedc89 --- /dev/null +++ b/bookmarks/templates/django_registration/registration_complete.html @@ -0,0 +1,16 @@ +{% extends 'bookmarks/layout.html' %} +{% load widget_tweaks %} + +{% block title %}Registration complete{% endblock %} + +{% block content %} + +
+
+
+

Registration complete. You can now use the application.

+
+
+
+ +{% endblock %} diff --git a/bookmarks/templates/django_registration/registration_form.html b/bookmarks/templates/django_registration/registration_form.html new file mode 100644 index 0000000..d9347da --- /dev/null +++ b/bookmarks/templates/django_registration/registration_form.html @@ -0,0 +1,44 @@ +{% extends 'bookmarks/layout.html' %} +{% load widget_tweaks %} + +{% block title %}Registration{% endblock %} + +{% block content %} + +
+
+
+
+

Register

+
+
+ {% csrf_token %} +
+ + {{ form.username|add_class:'form-input' }} +
{{ form.errors.username }}
+
+
+ + {{ form.email|add_class:'form-input' }} +
{{ form.errors.email }}
+
+
+ + {{ form.password1|add_class:'form-input' }} +
{{ form.errors.password1 }}
+
+
+ + {{ form.password2|add_class:'form-input' }} +
{{ form.errors.password2 }}
+
+ + + +
+
+
+
+ +{% endblock %} diff --git a/bookmarks/templates/registration/login.html b/bookmarks/templates/registration/login.html index 5ea46cd..f188bef 100644 --- a/bookmarks/templates/registration/login.html +++ b/bookmarks/templates/registration/login.html @@ -5,7 +5,7 @@ {% block content %} -
+
@@ -23,12 +23,22 @@ {{ form.username|add_class:'form-input' }}
- + {{ form.password|add_class:'form-input' }}
- - +
+
+ + +
+ {% if allow_registration %} +
+ Register +
+ {% endif %} +
+
diff --git a/requirements.prod.txt b/requirements.prod.txt index 0c6c43e..a08f85f 100644 --- a/requirements.prod.txt +++ b/requirements.prod.txt @@ -6,6 +6,7 @@ django-appconf==1.0.3 django-compressor==2.3 django-generate-secret-key==1.0.2 django-picklefield==2.0 +django-registration==3.0.1 django-sass-processor==0.7.3 django-widget-tweaks==1.4.5 idna==2.8 diff --git a/requirements.txt b/requirements.txt index ae5aa48..1a01b94 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,13 @@ beautifulsoup4==4.7.1 certifi==2019.6.16 chardet==3.0.4 +confusable-homoglyphs==3.2.0 Django==2.2.2 django-appconf==1.0.3 django-compressor==2.3 django-generate-secret-key==1.0.2 django-picklefield==2.0 +django-registration==3.0.1 django-sass-processor==0.7.3 django-widget-tweaks==1.4.5 idna==2.8 diff --git a/siteroot/settings/base.py b/siteroot/settings/base.py index ade2d14..96747fb 100644 --- a/siteroot/settings/base.py +++ b/siteroot/settings/base.py @@ -141,3 +141,6 @@ STATICFILES_FINDERS = [ STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'bookmarks', 'styles'), ] + +# Registration switch +ALLOW_REGISTRATION = False diff --git a/siteroot/settings/custom.py b/siteroot/settings/custom.py index fcfe4e5..143330e 100644 --- a/siteroot/settings/custom.py +++ b/siteroot/settings/custom.py @@ -1 +1,3 @@ # Placeholder, can be mounted in a Docker container with a custom settings + +# ALLOW_REGISTRATION = True diff --git a/siteroot/urls.py b/siteroot/urls.py index a52365c..a0e9f09 100644 --- a/siteroot/urls.py +++ b/siteroot/urls.py @@ -16,10 +16,16 @@ Including another URLconf from django.contrib import admin from django.contrib.auth import views as auth_views from django.urls import path, include +from .settings import ALLOW_REGISTRATION urlpatterns = [ path('admin/', admin.site.urls), - path('login/', auth_views.LoginView.as_view(redirect_authenticated_user=True), name='login'), + path('login/', auth_views.LoginView.as_view(redirect_authenticated_user=True, + extra_context=dict(allow_registration=ALLOW_REGISTRATION)), + name='login'), path('logout/', auth_views.LogoutView.as_view(), name='logout'), path('', include('bookmarks.urls')), ] + +if ALLOW_REGISTRATION: + urlpatterns.append(path('', include('django_registration.backends.one_step.urls')))