Skip to content
Snippets Groups Projects
Commit 4060c092 authored by Zdenek Kubala's avatar Zdenek Kubala
Browse files

first commit with auth

parent ba52648a
No related branches found
No related tags found
No related merge requests found
......@@ -29,9 +29,11 @@ ALLOWED_HOSTS = []
# Application definition
#'polls.apps.PollsConfig',
INSTALLED_APPS = [
'polls.apps.PollsConfig',
'sifrovacka.apps.SifrovackaConfig',
'django_registration',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
......
......@@ -17,7 +17,7 @@ from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('polls/', include('polls.urls')),
# path('polls/', include('polls.urls')),
path('sifrovacka/', include('sifrovacka.urls')),
path('admin/', admin.site.urls),
]
asgiref==3.3.4
asn1crypto==0.24.0
confusable-homoglyphs==3.2.0
cryptography==2.6.1
Django==3.2.3
django-registration==3.1.2
entrypoints==0.3
keyring==17.1.1
keyrings.alt==3.1.1
......
{% load static %}
<!doctype html>
<html lang="cs">
<head>
<!-- Meta -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width" />
{% if settings.SIFROVACKA_ENV == "test" %}
<meta name="robots" content="noindex, nofollow">
{% endif %}
<!-- Favicon -->
{% comment%}
{% include "shared/favicon_snippet.html" %}
{% endcomment %}
<!-- Styles -->
<link href="https://styleguide.pir-test.eu/2.3.x/css/styles.css" rel="stylesheet" media="all" />
<style type="text/css">
.head-alt-md, .head-alt-lg {
line-height: 1.25;
}
.content-block a {
color: #004958;
}
.text-white a {
color: #FFFFFF;
}
a.btn {
text-decoration: none !important;
}
</style>
{% if settings.SIFROVACKA_ENV == "prod" and settings.ONBOARDING_MATOMO_ID %}
{% include "shared/matomo_snippet.html" with matomo_id=settings.ONBOARDING_MATOMO_ID %}
{% endif %}
<title>Šifrovačky</title>
</head>
<body>
{% if settings.SIFROVACKA_ENV == "test" %}
<div class="bg-yellow-200 p-2 text-center flex-grow"><b>TESTOVACÍ VERZE!</b> &nbsp;&nbsp; Informace nemusejí odpovídat skutečnosti.</div>
{% endif %}
<nav class="navbar navbar--simple __js-root">
<div>
<div class="container container--wide navbar__content navbar__content--initialized">
<div class="navbar__brand my-4 flex items-center lg:pr-8 lg:my-0">
<a href="/"><img src="https://styleguide.pir-test.eu/2.3.x/images/logo-round-white.svg" class="w-8"></a>
<span class="pl-4 font-bold text-xl lg:border-r lg:border-grey-300 lg:pr-8">
Šifrovačky
{% if settings.SIFROVACKA_ENV == "dev" %}<sup class="text-cyan-100">(DEV)</sup>{% endif %}
</span>
</div>
<div class="navbar__menutoggle my-4 flex justify-end lg:hidden">
<a href="#" class="no-underline hover:no-underline"><i class="ico--menu text-3xl"></i></a>
</div>
<div class="navbar__main navbar__section navbar__section--expandable container-padding--zero lg:container-padding--auto flex items-center">
<div class="flex-grow">
<ul class="navbar-menu text-white">
<li class="navbar-menu__item">
<!--<a href="#" data-href="#" class="navbar-menu__link">Hlavní strana</a>-->
</li>
</ul>
</div>
<div class="flex items-center space-x-4">
{% if user.is_authenticated %}
<span class="head-heavy-2xs">{{ user }}</span>
{% comment %}
{% endcomment %}
<form action="{% url "accounts/logout" %}" method="post">
{% csrf_token %}
<button class="text-grey-200 hover:text-white" title="Odhlásit se"><i class="ico--log-out"></i></button>
</form>
{% else %}
{% comment %}
{% endcomment %}
<a class="btn btn--grey-125 btn--hoveractive btn--to-white" href="{% url "accounts/login" %}">
<div class="btn__body ">přihlášení</div>
</a>
{% endif %}
</div>
</div>
</div>
</div>
</nav>
{% if messages %}
<div class="container container--default pt-3">
{% for message in messages %}
<div class="alert alert--{{ message.level_tag }}">{{ message }}</div>
{% endfor %}
</div>
{% endif %}
<div class="container container--default py-8 lg:py-24">
<div class="content-block">
{% block content %}{% endblock %}
</div>
</div>
<footer class="footer bg-grey-700 text-white __js-root">
<ui-app inline-template>
<div>
<div class="footer__main py-4 lg:py-16 container container--default">
<section class="footer__brand">
<a href="https://www.pirati.cz">
<img src="https://styleguide.pir-test.eu/2.3.x/images/logo-full-white.svg" alt="logo pirátské strany" class="w-32 md:w-40 pb-6" />
</a>
<p class="para hidden md:block md:mb-4 lg:mb-0 text-grey-200">
<span class="copyleft inline-block">&copy;</span> {% now "Y" %} Piráti. Všechna práva vyhlazena. Sdílejte a nechte ostatní sdílet za stejných podmínek.
</p>
</section>
<section class="footer__social lg:text-right">
<div class="mb-4">
<div class="social-icon-group space-x-2 text-white pb-4">
<a href="https://www.pirati.cz" class="social-icon "><i class="ico--home"></i></a>
<a href="https://www.facebook.com/ceska.piratska.strana/" class="social-icon "><i class="ico--facebook"></i></a>
<a href="https://twitter.com/PiratskaStrana" class="social-icon "><i class="ico--twitter"></i></a>
<a href="https://www.youtube.com/user/CeskaPiratskaStrana" class="social-icon "><i class="ico--youtube"></i></a>
<a href="https://www.instagram.com/pirati.cz/" class="social-icon "><i class="ico--instagram"></i></a>
<a href="https://www.flickr.com/photos/pirati/" class="social-icon "><i class="ico--flickr"></i></a>
</div>
</div>
<div class="flex flex-col md:flex-row lg:flex-col lg:items-end space-y-2 md:space-y-0 md:space-x-2 lg:space-x-0 lg:space-y-2">
<a href="https://dary.pirati.cz" class="btn btn--icon btn--cyan-200 btn--hoveractive text-lg btn--fullwidth sm:btn--autowidth">
<div class="btn__body-wrap">
<div class="btn__body ">Přispěj</div>
<div class="btn__icon ">
<i class="ico--pig"></i>
</div>
</div>
</a>
<a href="https://nalodeni.pirati.cz" class="btn btn--icon btn--blue-300 btn--hoveractive text-lg btn--fullwidth sm:btn--autowidth">
<div class="btn__body-wrap">
<div class="btn__body ">Naloď se</div>
<div class="btn__icon ">
<i class="ico--anchor"></i>
</div>
</div>
</a>
</div>
</section>
</div>
</div>
</ui-app>
</footer>
<script src="{% static "shared/vendor/vue/vue.2.6.11.js" %}"></script>
<script src="https://styleguide.pir-test.eu/2.3.x/js/main.bundle.js"></script>
<script src="{% static "shared/vendor/jquery/jquery-3.4.1.min.js" %}"></script>
{% block extra_js %}{% endblock %}
</body>
</html>
{% extends "registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Log in" %}{% endblock %}
{% block content %}
<form method="post" action="">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% trans 'Log in' %}" />
<input type="hidden" name="next" value="{{ next }}" />
</form>
<p>{% trans "Forgot your password?" %} <a href="{% url 'auth_password_reset' %}">{% trans "Reset it" %}</a>.</p>
<p>{% trans "Not a member?" %} <a href="{% url 'registration_register' %}">{% trans "Register" %}</a>.</p>
{% endblock %}
{% comment %}
**registration/login.html**
It's your responsibility to provide the login form in a template called
registration/login.html by default. This template gets passed four
template context variables:
``form``
A Form object representing the login form. See the forms
documentation for more on Form objects.
``next``
The URL to redirect to after successful login. This may contain a
query string, too.
``site``
The current Site, according to the SITE_ID setting. If you don't
have the site framework installed, this will be set to an instance
of RequestSite, which derives the site name and domain from the
current HttpRequest.
``site_name``
An alias for site.name. If you don't have the site framework
installed, this will be set to the value of
request.META['SERVER_NAME']. For more on sites, see The
"sites" framework.
{% endcomment %}
{% extends "base.html" %}
<h2>Sign up</h2>
<form method="post">
{% csrf_token %}
{% for field in form %}
<p>
{{ field.label_tag }}<br>
{{ field }}
{% if field.help_text %}
<small style="color: grey">{{ field.help_text }}</small>
{% endif %}
{% for error in field.errors %}
<p style="color: red">{{ error }}</p>
{% endfor %}
</p>
{% endfor %}
<button type="submit">Sign up</button>
</form>
{% endblock %}
{% extends "django_registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Registration is closed" %}{% endblock %}
{% block content %}
<p>{% trans "Sorry, but registration is closed at this moment. Come back later." %}</p>
{% endblock %}
{% extends "django_registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Activation email sent" %}{% endblock %}
{% block content %}
<p>{% trans "Please check your email to complete the registration process." %}</p>
{% endblock %}
{% comment %}
**registration/registration_complete.html**
Used after successful completion of the registration form. This
template has no context variables of its own, and should simply inform
the user that an email containing account-activation information has
been sent.
{% endcomment %}
{% extends "django_registration/registration_base.html" %}
{% load i18n %}
{% block title %}{% trans "Register for an account" %}{% endblock %}
{% block content %}
<form method="post" action="">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% trans 'Submit' %}" />
</form>
{% endblock %}
{% comment %}
**registration/registration_form.html**
Used to show the form users will fill out to register. By default, has
the following context:
``form``
The registration form. This will be an instance of some subclass
of ``django.forms.Form``; consult `Django's forms documentation
<http://docs.djangoproject.com/en/dev/topics/forms/>`_ for
information on how to display this in a template.
{% endcomment %}
{% extends "base.html" %}
{% block content %}
{% if active_sifrovacka_list %}
<ul>
{% for sifrovacka in active_sifrovacka_list %}
<li><a href="/sifrovacka/{{ sifrovacka.id }}/">{{ sifrovacka.sifrovacka_name }}</a></li>
{% endfor %}
</ul>
{% else %}
<p>Žádné šifrovačky nejsou aktivní.</p>
{% endif %}
{% endblock %}
from django.urls import path
from django.urls import include,path
from . import views
urlpatterns = [
# accounts uls
path('accounts/', include('django_registration.backends.one_step.urls')),
path('accounts/', include('django.contrib.auth.urls')),
# /
path('', views.index, name='index'),
]
......@@ -2,7 +2,18 @@ from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse
from django.template import loader
from django.contrib.auth import login,logout
#def index(request):
# return HttpResponse("Hello, world. You're at the polls index.")
def index(request):
return HttpResponse("Hello, world. You're at the polls index.")
template = loader.get_template('index.html')
context = {"": ""}
return HttpResponse(template.render(context, request))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment