mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-01-24 08:14:13 +03:00
Fix authentication
This commit is contained in:
parent
fde4554560
commit
618cd6018a
|
@ -27,7 +27,7 @@ https://bitbucket.org/andrewgodwin/south/get/59f6bae8b1a501ca14a5f23f8b11c44c42f
|
|||
|
||||
# Useful things
|
||||
# django-avatar that work with Django 1.5+
|
||||
# git+git://github.com/jezdez/django-avatar@6393d25166a6c2d2df0bd28e19f161fac2bb1166
|
||||
git+git://github.com/jezdez/django-avatar@6393d25166a6c2d2df0bd28e19f161fac2bb1166
|
||||
|
||||
|
||||
# django-crispy-forms with support for Bootstrap 3
|
||||
|
|
|
@ -177,18 +177,19 @@ WSGI_APPLICATION = 'config.wsgi.application'
|
|||
########## End URL Configuration
|
||||
|
||||
########## django-secure
|
||||
INSTALLED_APPS += ("djangosecure", )
|
||||
|
||||
# set this to 60 seconds and then to 518400 when you can prove it works
|
||||
SECURE_HSTS_SECONDS = 60
|
||||
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
|
||||
SECURE_FRAME_DENY = True
|
||||
SECURE_CONTENT_TYPE_NOSNIFF = True
|
||||
SECURE_BROWSER_XSS_FILTER = True
|
||||
SESSION_COOKIE_SECURE = True
|
||||
SESSION_COOKIE_HTTPONLY = True
|
||||
SECURE_SSL_REDIRECT = True
|
||||
SECURE = False
|
||||
if SECURE:
|
||||
INSTALLED_APPS += ("djangosecure", )
|
||||
|
||||
# set this to 60 seconds and then to 518400 when you can prove it works
|
||||
SECURE_HSTS_SECONDS = 60
|
||||
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
|
||||
SECURE_FRAME_DENY = True
|
||||
SECURE_CONTENT_TYPE_NOSNIFF = True
|
||||
SECURE_BROWSER_XSS_FILTER = True
|
||||
SESSION_COOKIE_SECURE = True
|
||||
SESSION_COOKIE_HTTPONLY = True
|
||||
SECURE_SSL_REDIRECT = True
|
||||
########## end django-secure
|
||||
|
||||
|
||||
|
|
|
@ -26,37 +26,26 @@
|
|||
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</a>
|
||||
<a class="brand" href="{% url 'home' %}">{{ project_name }}</a>
|
||||
<div class="nav-collapse collapse">
|
||||
<ul class="nav">
|
||||
<li class="active"><a href="{% url 'home' %}">Home</a></li>
|
||||
<li><a href="{% url 'about' %}">About</a></li>
|
||||
<div class="header navbar">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="/">{{cookiecutter.repo_name}}</a>
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="active"><a href="{% url 'home' %}">Home</a></li>
|
||||
<li><a href="{% url 'about' %}">About</a></li>
|
||||
|
||||
{% if request.user.is_authenticated %}
|
||||
<a href="{% url 'users:detail' request.user.username %}">{% trans "My Profile" %}</a>
|
||||
<a href="{% url 'account_logout' %}">{% trans "Logout" %}</a>
|
||||
{% else %}
|
||||
<a href="{% url 'account_signup' %}">{% trans "Sign Up" %}</a> or
|
||||
<a href="{% url 'account_login' %}">{% trans "Log In" %}</a>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
||||
{% if request.user.is_authenticated %}
|
||||
<li><a href="{% url 'users:detail' request.user.username %}">{% trans "My Profile" %}</a></li>
|
||||
<li><a href="{% url 'account_logout' %}">{% trans "Logout" %}</a></li>
|
||||
{% else %}
|
||||
<li><a href="{% url 'account_signup' %}">{% trans "Sign Up" %}</a></li>
|
||||
<li><a href="{% url 'account_login' %}">{% trans "Log In" %}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<h1>{% block page_title %}Example Base Template{% endblock page_title %}</h1>
|
||||
|
||||
{% block content %}
|
||||
<p>Use this document as a way to quick start any new project.</p>
|
||||
{% endblock content %}
|
||||
|
|
Loading…
Reference in New Issue
Block a user