diff --git a/accounts/static/css/styles.css b/accounts/static/css/styles.css new file mode 100644 index 0000000..d7009ee --- /dev/null +++ b/accounts/static/css/styles.css @@ -0,0 +1,5 @@ +.sidebar-nav { + margin-top: 20px; + padding: 0; + list-style: none; +} \ No newline at end of file diff --git a/accounts/templates/base_generic.html b/accounts/templates/base_generic.html new file mode 100644 index 0000000..d400ea4 --- /dev/null +++ b/accounts/templates/base_generic.html @@ -0,0 +1,33 @@ + + +
+ {% block title %}Logged out!
+ Click here to login again. +{% endblock %} \ No newline at end of file diff --git a/accounts/templates/registration/login.html b/accounts/templates/registration/login.html new file mode 100644 index 0000000..f5f2bea --- /dev/null +++ b/accounts/templates/registration/login.html @@ -0,0 +1,40 @@ +{% extends "base_generic.html" %} + +{% block content %} + +{% if form.errors %} +Your username and password didn't match. Please try again.
+{% endif %} + +{% if next %} + {% if user.is_authenticated %} +Your account doesn't have access to this page. To proceed, + please login with an account that has access.
+ {% else %} +Please login to see this page.
+ {% endif %} +{% endif %} + + + +{# Assumes you setup the password_reset view in your URLconf #} + + +{% endblock %} \ No newline at end of file diff --git a/accounts/templates/registration/password_reset_complete.html b/accounts/templates/registration/password_reset_complete.html new file mode 100644 index 0000000..a498b4b --- /dev/null +++ b/accounts/templates/registration/password_reset_complete.html @@ -0,0 +1,6 @@ +{% extends "base_generic.html" %} + +{% block content %} +Please enter (and confirm) your new password.
+ + {% else %} +The password reset link was invalid, possibly because it has already been used. Please request a new password reset.
+ {% endif %} +{% endblock %} \ No newline at end of file diff --git a/accounts/templates/registration/password_reset_done.html b/accounts/templates/registration/password_reset_done.html new file mode 100644 index 0000000..373b3fb --- /dev/null +++ b/accounts/templates/registration/password_reset_done.html @@ -0,0 +1,5 @@ +{% extends "base_generic.html" %} + +{% block content %} +We've emailed you instructions for setting your password. If they haven't arrived in a few minutes, check your spam folder.
+{% endblock %} \ No newline at end of file diff --git a/accounts/templates/registration/password_reset_email.html b/accounts/templates/registration/password_reset_email.html new file mode 100644 index 0000000..61fba5c --- /dev/null +++ b/accounts/templates/registration/password_reset_email.html @@ -0,0 +1,2 @@ +Someone asked for password reset for email {{ email }}. Follow the link below: +{{ protocol}}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %} \ No newline at end of file diff --git a/accounts/templates/registration/password_reset_form.html b/accounts/templates/registration/password_reset_form.html new file mode 100644 index 0000000..0f811c9 --- /dev/null +++ b/accounts/templates/registration/password_reset_form.html @@ -0,0 +1,12 @@ +{% extends "base_generic.html" %} + +{% block content %} + +{% endblock %} \ No newline at end of file diff --git a/accounts/views.py b/accounts/views.py index 296705b..44e221b 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -30,4 +30,4 @@ class IndexView(generic.ListView): context_object_name = 'best_players' def get_queryset(self): - return Players.objects.filter(group_id=1).order_by('-level')[:10] \ No newline at end of file + return Players.objects.filter(group_id=1).order_by('-level').values('name', 'level')[:10] \ No newline at end of file diff --git a/tibia_website/settings.py b/tibia_website/settings.py index 3f4b906..d6354ad 100644 --- a/tibia_website/settings.py +++ b/tibia_website/settings.py @@ -55,7 +55,7 @@ ROOT_URLCONF = 'tibia_website.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [os.path.join(BASE_DIR, 'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -123,3 +123,7 @@ USE_TZ = True # https://docs.djangoproject.com/en/2.1/howto/static-files/ STATIC_URL = '/static/' + +# Redirect to home URL after login (Default redirects to /accounts/profile/) +LOGIN_REDIRECT_URL = '/' + diff --git a/tibia_website/urls.py b/tibia_website/urls.py index 21b6cd1..decd944 100644 --- a/tibia_website/urls.py +++ b/tibia_website/urls.py @@ -18,5 +18,6 @@ from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), - path('accounts/', include('accounts.urls') ) + path('accounts/', include('accounts.urls')), + path('auth/', include('django.contrib.auth.urls')), ]