diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..5d534b58810e9aadff76925e424c26ffa166e272 --- /dev/null +++ b/.gitignore @@ -0,0 +1,106 @@ +__pycache__ +*.py[cod] +*$py.class + +# Distribution / packaging +.Python build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +*.manifest +*.spec + +# Log files +pip-log.txt +pip-delete-this-directory.txt +*.log + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +.pytest_cache/ +nosetests.xml +coverage.xml +*.cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pyflow +__pypackages__/ + +# Environment +.env +.venv +env/ +venv/ +ENV/ + +# If you are using PyCharm # +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/gradle.xml +.idea/**/libraries +*.iws /out/ + +# Sublime Text +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache +*.sublime-workspace +*.sublime-project + +# sftp configuration file +sftp-config.json + +# Package control specific files Package +Control.last-run +Control.ca-list +Control.ca-bundle +Control.system-ca-bundle +GitHub.sublime-settings + +# Visual Studio Code # +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +.history diff --git a/django_apps/settings.py b/django_apps/settings.py index 1bbaa653a0325ba44b9c9c6f24abf1fe52abb09d..41de1bcb82a64d519304848745b8e7e8993229f3 100644 --- a/django_apps/settings.py +++ b/django_apps/settings.py @@ -126,3 +126,8 @@ STATIC_URL = '/static/' # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +# Custom settings AUTH + +LOGIN_REDIRECT_URL = 'index' +LOGOUT_REDIRECT_URL = 'index' diff --git a/sifrovacka/templates/base.html b/sifrovacka/templates/base.html index e024652b13b37ae20bf46bd8de42fadeb9ccfc6c..28bd8c555aa3cf86d984ba7804b3d9ce5b5ea8ee 100644 --- a/sifrovacka/templates/base.html +++ b/sifrovacka/templates/base.html @@ -71,16 +71,19 @@ <span class="head-heavy-2xs">{{ user }}</span> {% comment %} {% endcomment %} - <form action="{% url "accounts/logout" %}" method="post"> + <form action="{% url "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" %}"> + <a class="btn btn--grey-125 btn--hoveractive btn--to-white" href="{% url "login" %}"> <div class="btn__body ">přihlášení</div> </a> + <a class="btn btn--grey-125 btn--hoveractive btn--to-white" href="{% url "django_registration_register" %}"> + <div class="btn__body ">registrace</div> + </a> {% endif %} </div> </div> diff --git a/sifrovacka/templates/django_registration/registration_base.html b/sifrovacka/templates/django_registration/registration_base.html index d609d2d1a68f5d607a670c60464cb997df3b8005..32adb094f5f1f760b919033db55c43566cf49434 100644 --- a/sifrovacka/templates/django_registration/registration_base.html +++ b/sifrovacka/templates/django_registration/registration_base.html @@ -1,5 +1,6 @@ {% extends "base.html" %} +{% comment %} <h2>Sign up</h2> <form method="post"> {% csrf_token %} @@ -19,3 +20,4 @@ </form> {% endblock %} +{% endcomment %} diff --git a/sifrovacka/templates/django_registration/login.html b/sifrovacka/templates/registration/login.html similarity index 83% rename from sifrovacka/templates/django_registration/login.html rename to sifrovacka/templates/registration/login.html index 2e029badb4d1a3e81a91b3cdc784fe02c23bf5a8..17f6b6ff3f5f2843a020595f109f89a85ed401f8 100644 --- a/sifrovacka/templates/django_registration/login.html +++ b/sifrovacka/templates/registration/login.html @@ -1,4 +1,7 @@ -{% extends "registration/registration_base.html" %} +{% extends "base.html" %} +{% comment %} +{% extends "django_registration/registration_base.html" %} +{% endcomment %} {% load i18n %} {% block title %}{% trans "Log in" %}{% endblock %} @@ -11,8 +14,10 @@ <input type="hidden" name="next" value="{{ next }}" /> </form> +{% comment %} <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> +<p>{% trans "Nemáte účet?" %} <a href="{% url 'django_registration_register' %}">{% trans "Register" %}</a>.</p> +{% endcomment %} {% endblock %} diff --git a/sifrovacka/templates/registration/logout.html b/sifrovacka/templates/registration/logout.html new file mode 100644 index 0000000000000000000000000000000000000000..c8ea686ba0d17011a67f4db5e0258fc7dca8c576 --- /dev/null +++ b/sifrovacka/templates/registration/logout.html @@ -0,0 +1,8 @@ +{% extends "django_registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Logged out" %}{% endblock %} + +{% block content %} +<p>{% trans "Successfully logged out" %}.</p> +{% endblock %} diff --git a/sifrovacka/templates/registration/profile.html b/sifrovacka/templates/registration/profile.html new file mode 100644 index 0000000000000000000000000000000000000000..77fccd9f5caccbdff920d048ffa9e530da78b89d --- /dev/null +++ b/sifrovacka/templates/registration/profile.html @@ -0,0 +1,50 @@ +{% extends "base.html" %} +{% comment %} +{% extends "django_registration/registration_base.html" %} +{% endcomment %} +{% load i18n %} + +{% block title %}{% trans "Profile" %}{% 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> + +{% comment %} +<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> +{% endcomment %} +{% 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 %}