Skip to content

Commit

Permalink
add FAS login
Browse files Browse the repository at this point in the history
relates to #7
  • Loading branch information
Jakub Dorňák committed May 4, 2015
1 parent 55bc978 commit 8894827
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
33 changes: 26 additions & 7 deletions fedora_software/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,35 @@

INSTALLED_APPS = (
#'django.contrib.admin',
#'django.contrib.auth',
#'django.contrib.contenttypes',
#'django.contrib.sessions',
#'django.contrib.messages',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'fedora_software',
)

MIDDLEWARE_CLASSES = (
#'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
#'django.contrib.auth.middleware.AuthenticationMiddleware',
#'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.locale.LocaleMiddleware',
)

TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.core.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
)

ROOT_URLCONF = 'fedora_software.urls'

WSGI_APPLICATION = 'fedora_software.wsgi.application'
Expand Down Expand Up @@ -129,6 +140,14 @@
},
}

AUTHENTICATION_BACKENDS = (
'fas.backend.FasBackend',
)

LOGIN_URL = '/login/'
LOGOUT_URL = '/logout/'
LOGIN_REDIRECT_URL = '/'

FS_HIGHLIGHT_APPS = [
'shotwell.desktop',
'datovka.desktop',
Expand Down
8 changes: 8 additions & 0 deletions fedora_software/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@
</select>
</form>
</li>
<li>
{% if request.user.is_authenticated %}
<span> {{ request.user.first_name }} {{ request.user.last_name }} </span>
<small> - <a href='{% url "fas-logout" %}'> Log out </a> </small>
{% else %}
<small> <a href='{% url "fas-login" %}?next={{ request.path }}'>Log in</a> </small>
{% endif %}
</li>
</ul> <!-- .nav navbar-nav navbar-right -->
</div> <!-- #navbar -->

Expand Down
1 change: 1 addition & 0 deletions fedora_software/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
url(r'^category/(?P<slug>.*)$', CategoryView.as_view(), name='category'),
url(r'^faq$', FaqView.as_view(), name='faq'),
url(r'^i18n/', include('django.conf.urls.i18n')),
url('', include('fas.urls')),
)

0 comments on commit 8894827

Please sign in to comment.