*.pyc
*.sqlite
+localsettings.py
+++ /dev/null
-Chris Williams <chris@nitron.org>
-Marek Stepniowski <marek@stepniowski.com>
+++ /dev/null
-Copyright (c) 2009, Chris Williams
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- * Neither the name of the author nor the names of other
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+++ /dev/null
-recursive-include cas_provider/templates *.html
-include README.rst
-include LICENSE
\ No newline at end of file
+++ /dev/null
-===================
-django-cas-provider
-===================
-
-OVERVIEW
-=========
-
-django-cas-provider is a provider for the `Central Authentication Service <http://jasig.org/cas>`_. It supports CAS version 1.0 and parts of CAS version 2.0 protocol. It allows remote services to authenticate users for the purposes of Single Sign-On (SSO). For example, a user logs into a CAS server
-(provided by django-cas-provider) and can then access other services (such as email, calendar, etc) without re-entering her password for each service. For more details, see the `CAS wiki <http://www.ja-sig.org/wiki/display/CAS/Home>`_ and `Single Sign-On on Wikipedia <http://en.wikipedia.org/wiki/Single_Sign_On>`_.
-
-INSTALLATION
-=============
-
-To install, run the following command from this directory::
-
- python setup.py install
-
-Or, put `cas_provider` somewhere on your Python path.
-
-USAGE
-======
-
-#. Add ``'cas_provider'`` to your ``INSTALLED_APPS`` tuple in *settings.py*.
-#. In *settings.py*, set ``LOGIN_URL`` to ``'/cas/login/'`` and ``LOGOUT_URL`` to ``'/cas/logout/'``
-#. In *urls.py*, put the following line: ``(r'^cas/', include('cas_provider.urls')),``
-#. Create login/logout templates (or modify the samples)
+++ /dev/null
-from django.conf import settings
-
-__all__ = []
-
-_DEFAULTS = {
- 'CAS_TICKET_EXPIRATION': 5, # In minutes
- 'CAS_CUSTOM_ATTRIBUTES_CALLBACK': None,
-}
-
-for key, value in _DEFAULTS.iteritems():
- try:
- getattr(settings, key)
- except AttributeError:
- setattr(settings, key, value)
- except ImportError:
- pass
\ No newline at end of file
+++ /dev/null
-from django.contrib import admin
-
-from cas_provider.models import ServiceTicket, LoginTicket
-
-class ServiceTicketAdmin(admin.ModelAdmin):
- pass
-admin.site.register(ServiceTicket, ServiceTicketAdmin)
-
-class LoginTicketAdmin(admin.ModelAdmin):
- pass
-admin.site.register(LoginTicket, LoginTicketAdmin)
\ No newline at end of file
+++ /dev/null
-# lxml http://codespeak.net/lxml/
-from lxml import etree
-
-# Define register_namespace function and ElementRoot for proper serialization
-NSMAP = {}
-
-
-def register_namespace(prefix, uri):
- NSMAP[prefix] = uri
-
-
-def ElementRoot(*args, **kwargs):
- kwargs['nsmap'] = NSMAP
- return etree.Element(*args, **kwargs)
-
-__all__ = ('etree', 'register_namespace', 'ElementRoot')
+++ /dev/null
-from django import forms
-from django.contrib.auth.forms import AuthenticationForm
-from django.contrib.auth import authenticate
-
-from cas_provider.utils import create_login_ticket
-
-class LoginForm(forms.Form):
- username = forms.CharField(max_length=30)
- password = forms.CharField(widget=forms.PasswordInput)
- #warn = forms.BooleanField(required=False) # TODO: Implement
- lt = forms.CharField(widget=forms.HiddenInput, initial=create_login_ticket)
- def __init__(self, service=None, renew=None, gateway=None, request=None, *args, **kwargs):
- super(LoginForm, self).__init__(*args, **kwargs)
- self.request = request
- if service is not None:
- self.fields['service'] = forms.CharField(widget=forms.HiddenInput, initial=service)
\ No newline at end of file
+++ /dev/null
-"""
-A management command which deletes expired service tickets (e.g.,
-from the database.
-
-Calls ``ServiceTickets.objects.delete_expired_users()``, which
-contains the actual logic for determining which accounts are deleted.
-
-"""
-
-from django.core.management.base import NoArgsCommand
-from django.core.management.base import CommandError
-from django.conf import settings
-
-import datetime
-
-from cas_provider.models import ServiceTicket, LoginTicket
-
-class Command(NoArgsCommand):
- help = "Delete expired service tickets from the database"
-
- def handle_noargs(self, **options):
- print "Service tickets:"
- tickets = ServiceTicket.objects.all()
- for ticket in tickets:
- expiration = datetime.timedelta(minutes=settings.CAS_TICKET_EXPIRATION)
- if datetime.datetime.now() > ticket.created + expiration:
- print "Deleting %s..." % ticket.ticket
- ticket.delete()
- else:
- print "%s not expired..." % ticket.ticket
- tickets = LoginTicket.objects.all()
- print "Login tickets:"
- for ticket in tickets:
- expiration = datetime.timedelta(minutes=settings.CAS_TICKET_EXPIRATION)
- if datetime.datetime.now() > ticket.created + expiration:
- print "Deleting %s..." % ticket.ticket
- ticket.delete()
- else:
- print "%s not expired..." % ticket.ticket
\ No newline at end of file
+++ /dev/null
-from django.db import models
-from django.contrib.auth.models import User
-from django.conf import settings
-from django.core.urlresolvers import get_callable
-
-from cas_provider.etree import etree, register_namespace, ElementRoot
-
-class ServiceTicket(models.Model):
- user = models.ForeignKey(User)
- service = models.URLField(verify_exists=False)
- ticket = models.CharField(max_length=256)
- created = models.DateTimeField(auto_now=True)
-
- def __unicode__(self):
- return "%s (%s) - %s" % (self.user.username, self.service, self.created)
-
-class LoginTicket(models.Model):
- ticket = models.CharField(max_length=32)
- created = models.DateTimeField(auto_now=True)
-
- def __unicode__(self):
- return "%s - %s" % (self.ticket, self.created)
-
-CAS_URI = 'http://www.yale.edu/tp/cas'
-register_namespace('cas', CAS_URI)
-CAS = '{%s}' % CAS_URI
-
-def auth_success_response(user):
- attrs = {}
- if settings.CAS_CUSTOM_ATTRIBUTES_CALLBACK:
- callback = get_callable(settings.CAS_CUSTOM_ATTRIBUTES_CALLBACK)
- attrs = callback(user)
-
- response = ElementRoot(CAS + 'serviceResponse')
- auth_success = etree.SubElement(response, CAS + 'authenticationSuccess')
- username = etree.SubElement(auth_success, CAS + 'user')
- username.text = user.username
- for name, value in attrs.items():
- element = etree.SubElement(auth_success, name)
- element.text = value
- return unicode(etree.tostring(response, encoding='utf-8'), 'utf-8')
+++ /dev/null
-{% extends "base.html" %}
-
-{% block title %}
-Login
-{% endblock %}
-
-{% block content %}
- <form action='{% url login %}' method='post'>
- <fieldset>
- <legend>Log in to your account</legend>
- {% if errors %}
- <ul>
- {% for error in errors %}
- <li>{{ error|escape }}</li>
- {% endfor %}
- </ul>
- {% endif %}
- <table style="border: none;">
- {{ form.as_table }}
- </table>
- <p><input type="submit" value="Login"/></p>
- </fieldset>
- </form>
-{% endblock %}
+++ /dev/null
-{% extends "base.html" %}
-
-{% block title %}
-Logged out
-{% endblock %}
-
-{% block content %}
- <h3>Logged out</h3>
-
- <p>You have successfully logged out. To ensure that you are logged out of all services, please close your browser.</p>
- {% if url %}<p><a href="{{ url }}">Click here</a> to return to {{ url }}</p>{% endif %}
-{% endblock %}
+++ /dev/null
-from django.conf.urls.defaults import *
-
-from cas_provider.views import *
-
-urlpatterns = patterns('',
- url(r'^login/?$', login, name='cas_login'),
- url(r'^validate/?$', validate),
- url(r'^serviceValidate/?$', service_validate),
- url(r'^logout/?$', logout),
-)
+++ /dev/null
-from random import Random
-import string
-
-from cas_provider.models import ServiceTicket, LoginTicket
-
-def _generate_string(length=8, chars=string.ascii_letters + string.digits):
- """ Generates a random string of the requested length. Used for creation of tickets. """
- return ''.join(Random().sample(chars, length))
-
-def create_service_ticket(user, service):
- """ Creates a new service ticket for the specified user and service.
- Uses _generate_string.
- """
- ticket_string = 'ST-' + _generate_string(29) # Total ticket length = 29 + 3 = 32
- ticket = ServiceTicket(service=service, user=user, ticket=ticket_string)
- ticket.save()
- return ticket
-
-def create_login_ticket():
- """ Creates a new login ticket for the login form. Uses _generate_string. """
- ticket_string = 'LT-' + _generate_string(29)
- ticket = LoginTicket(ticket=ticket_string)
- ticket.save()
- return ticket_string
\ No newline at end of file
+++ /dev/null
-from django.http import HttpResponse, HttpResponseForbidden, HttpResponseRedirect
-from django.shortcuts import render_to_response
-from django.template import RequestContext
-from django.contrib.auth.models import User
-from django.contrib.auth import authenticate
-from django.contrib.auth import login as auth_login, logout as auth_logout
-from django.utils.encoding import smart_str
-from django.utils.translation import ugettext_lazy as _
-
-from cas_provider.forms import LoginForm
-from cas_provider.models import ServiceTicket, LoginTicket, auth_success_response
-from cas_provider.utils import create_service_ticket
-
-import urlparse, urllib
-
-try:
- from urlparse import parse_qs as url_parse_qs
-except ImportError:
- from cgi import parse_qs as url_parse_qs
-
-import logging
-logger = logging.getLogger("cas.provider")
-
-__all__ = ['login', 'validate', 'service_validate', 'logout']
-
-def _add_query_param(url, param, value):
- parsed = urlparse.urlparse(url)
- query = url_parse_qs(smart_str(parsed.query))
- query[param] = [unicode(value, 'utf-8')]
- query = [ ((k, v) if len(v) != 1 else (k, v[0])) for k, v in query.iteritems() ]
- parsed = urlparse.ParseResult(parsed.scheme, parsed.netloc,
- parsed.path, parsed.params,
- urllib.urlencode(query), parsed.fragment)
- return parsed.geturl()
-
-
-def login(request, template_name='cas/login.html', success_redirect='/accounts/'):
- service = request.GET.get('service', None)
-
- if request.user.is_authenticated():
- if service is not None:
- ticket = create_service_ticket(request.user, service)
- target = _add_query_param(service, 'ticket', ticket.ticket)
- logger.info("Redirecting to %s", target)
- return HttpResponseRedirect(target)
- else:
- logger.info("Redirecting to default: %s", success_redirect)
- return HttpResponseRedirect(success_redirect)
-
- errors = []
- if request.method == 'POST':
- username = request.POST.get('username', None)
- password = request.POST.get('password', None)
- service = request.POST.get('service', None)
- lt = request.POST.get('lt', None)
-
- logger.debug("User %s logging in", username)
-
- try:
- login_ticket = LoginTicket.objects.get(ticket=lt)
- except:
- errors.append(_(u'Login ticket expired. Please try again.'))
- else:
- login_ticket.delete()
- user = authenticate(username=username, password=password)
- if user is not None:
- if user.is_active:
- auth_login(request, user)
- if service is not None:
- ticket = create_service_ticket(user, service)
- target = _add_query_param(service, 'ticket', ticket.ticket)
- return HttpResponseRedirect(target)
- else:
- return HttpResponseRedirect(success_redirect)
- else:
- errors.append(_(u'This account is disabled.'))
- else:
- errors.append(_(u'Incorrect username and/or password.'))
-
- form = LoginForm(service)
- return render_to_response(template_name, {'form': form, 'errors': errors}, context_instance=RequestContext(request))
-
-def validate(request):
- service = request.GET.get('service', None)
- ticket_string = request.GET.get('ticket', None)
- if service is not None and ticket_string is not None:
- try:
- ticket = ServiceTicket.objects.get(ticket=ticket_string)
- username = ticket.user.username
- ticket.delete()
- return HttpResponse("yes\n%s\n" % username)
- except:
- pass
- return HttpResponse("no\n\n")
-
-def service_validate(request):
- service = request.GET.get('service', None)
- ticket_string = request.GET.get('ticket', None)
- if service is None or ticket_string is None:
- return HttpResponse(r'''<cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas">
- <cas:authenticationFailure code="INVALID_REQUEST">
- Not all required parameters were sent.
- </cas:authenticationFailure>
- </cas:serviceResponse>''', mimetype='application/xml')
-
- try:
- ticket = ServiceTicket.objects.get(ticket=ticket_string)
- ticket.delete()
- return HttpResponse(auth_success_response(ticket.user), mimetype='text/xml')
- except ServiceTicket.DoesNotExist:
- return HttpResponse(r'''<cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas">
- <cas:authenticationFailure code="INVALID_TICKET">
- The provided ticket is invalid.
- </cas:authenticationFailure>
- </cas:serviceResponse>''', mimetype='application/xml')
-
-def logout(request, template_name='cas/logout.html'):
- url = request.GET.get('url', None)
- auth_logout(request)
- return render_to_response(template_name, {'url': url}, context_instance=RequestContext(request))
+++ /dev/null
-[egg_info]
-tag_build = .dev
-tag_date = 1
\ No newline at end of file
+++ /dev/null
-from setuptools import setup, find_packages
-
-setup(
- name='django-cas-provider',
- version='0.2',
- description='A "provider" for the Central Authentication Service (http://jasig.org/cas)',
- author='Chris Williams',
- author_email='chris@nitron.org',
- url='http://nitron.org/',
- packages=find_packages(),
- include_package_data=True,
- zip_safe=False,
- install_requires=['setuptools'],
-)
-Django>=1.1.1,<1.2
-lxml>=2.2
\ No newline at end of file
+Django>=1.5,<1.6
+South
+lxml>=2.2
+django-gravatar
+
+-e git+https://github.com/gstrat/django-cas-provider.git@330bf3e9e9b5c3bff6d9258b2fb81a08b7f81e31#egg=django-cas-provider
{% block content %}
<div class="user_avatar">
- <img src="{% gravatar request.user.email 120 %}">
- <p><a href="{% url cas_provider.views.logout %}">{% trans "Logout" %}</a></p>
+ <img src="{% gravatar_for_email request.user.email 120 %}"
+ alt="Gravatar"
+ title="{% trans 'Change at Gravatar.com' %}">
+ <p><a href="{% url 'cas_provider.views.logout' %}">{% trans "Logout" %}</a></p>
</div>
<div id="details">
<h2>{% trans "Your profile" %}</h2>
<form method="post" action="/accounts/change_profile">
+ {% csrf_token %}
<table>
{{ basic_form.as_table }}
<tr><td colspan="2"><button type="submit">{% trans "Change profile" %}</button></td></tr>
<h2>{% trans "Password change" %}</h2>
<form method="post" action="/accounts/change_password">
+ {% csrf_token %}
<table>
{{ pass_form.as_table }}
<tr><td colspan="2"><button type="submit">{% trans "Change password" %}</button></td></tr>
</div>
<div id="services-list">
- <h2>{% trans "Availble services" %}</h2>
<a href="http://redakcja.wolnelektury.pl/">
<img src="{{ MEDIA_URL }}static/platforma.png">
</a>
+++ /dev/null
-from django import template
-from django.template.defaultfilters import stringfilter
-import hashlib
-import urllib
-
-register = template.Library()
-
-DEFAULTS = dict(size=80, rating='g', default='monsterid')
-
-class GravatarNode(template.Node):
-
- def __init__(self, email, size):
- self.email = template.Variable(email)
- self.size = size
-
- def render(self, context):
- try:
- email = self.email.resolve(context)
- except template.VariableDoesNotExist:
- return ''
-
- gravatar_url = "https://www.gravatar.com/avatar/" + hashlib.md5(email).hexdigest() + "?"
- gravatar_url += urllib.urlencode({'default': 'mm', 'size': str(self.size)})
-
- return gravatar_url
-
-@register.tag
-def gravatar(parser, token):
- try:
- _tag_name, email, size = token.split_contents()
- except ValueError:
- raise template.TemplateSyntaxError, "%r tag requires two args" % token.contents.split()[0]
-
- return GravatarNode(email, int(size))
-
-
-
-
-@register.filter(name='md5')
-@stringfilter
-def md5_hash(value):
- h = hashlib.md5()
- h.update(value)
- return h.hexdigest()
# -*- coding: utf-8 -*-
-from django.conf.urls.defaults import *
+from django.conf.urls import patterns, url
urlpatterns = patterns('accounts.views',
url(r'^$', 'account_profile'),
# Create your views here.
from django import http
+from django.contrib.auth.decorators import login_required
+from django.contrib import messages
+from django.shortcuts import render
from django.utils.translation import ugettext as __
-from django.views.generic.simple import direct_to_template
from django.views.decorators.http import require_POST
-from django.contrib.auth.decorators import login_required
from accounts.forms import UserBasicForm, UserPasswordForm
@login_required
def account_profile(request, basic_form=None, pass_form=None):
- return direct_to_template(request, "account/profile.html", {
+ return render(request, "account/profile.html", {
"basic_form": basic_form or UserBasicForm(instance=request.user),
"pass_form": pass_form or UserPasswordForm(),
})
if form.is_valid():
form.save()
- request.user.message_set.create(message=__("Profile has been changed."))
+ messages.add_message(request, messages.INFO, __("Profile has been changed."))
return http.HttpResponseRedirect('/accounts/')
return account_profile(request, basic_form=form)
request.user.set_password(form.cleaned_data['new_password'])
request.user.save()
- request.user.message_set.create(message=__("Password has been changed."))
+ messages.add_message(request, messages.INFO, __("Password has been changed."))
return http.HttpResponseRedirect('/accounts/')
return account_profile(request, pass_form=form)
PROJECT_ROOT = path.realpath(path.dirname(__file__))
sys.path = [
path.abspath(path.join(PROJECT_ROOT, '..')),
- path.abspath(path.join(PROJECT_ROOT, '..', '..', "provider")),
] + sys.path
try:
+.enclose {
+ text-align: center;
+ min-height: 500px;
+ background: url(/media/static/brackets.png) no-repeat 50% 0;
+ margin-top: 1em;
+}
+
+.enclosed {
+ margin-top: 7em;
+ display: inline-block;
+ text-align: left;
+ max-width: 300px;
+ background-color: rgb(247, 247, 247);
+ background-color: rgba(247, 247, 247, .5);
+}
+
+a {
+ text-decoration: none;
+}
+a:hover {
+ text-decoration: underline;
+}
+
+
+form p {
+ margin: 0;
+}
+form label, form input {
+ display: block;
+ width: 100%;
+}
+#login-form input {
+ font-size: 1.75em;
+ margin-bottom: .4em;
+}
+
+
+
+
+html, body {
+ margin: 0;
+ padding: 0;
+ height: 100%;
+}
body {
- background-color: #eee;
+ background-color: #F7F7F7;
+ color: black;
+ font-family: Lato;
}
-#content_wrap {
- background-color: #555;
- margin: 0px 5%;
- padding: 5px;
+#header-wrap {
+ background: #191919;
+ color: #989898;
+}
+header {
+ max-width: 960px;
+ margin: auto;
+ padding: 1em 0;
+}
+header img {
+ margin: 0 20px;
+ vertical-align: middle;
+}
+footer, #content_push {
+ height: 10em;
+}
+footer {
+
+}
+
+#content-wrap {
}
#content {
- background-color: white;
- border-radius: 10px;
- margin: 5px;
- padding: 0.2em 1em;
- overflow: hidden;
+ max-width: 960px;
+ margin: auto;
}
+#content-inner {
+}
+
+
+
+
#details {
margin: 1em;
}
.user_avatar img {
- border: 1px solid black;
+ box-shadow: 0 0 .2em black;
}
#services-list {
- width: 250px;
- float: right;
- margin: 1em 2em;
+ clear: both;
+ border-top: 1px solid red;
+}
+
+#services-list a {
+
}
#services-list img {
- width: 250px;
- margin: 1em 0em;
+ width: 90px;
+ height: 50px;
+ margin: 10px 10px 0 0;
}
+
img.small_logo {
width: 250px;
}
TEMPLATE_DEBUG = DEBUG
ADMINS = [
- "lrekucki@gmail.com",
]
MANAGERS = ADMINS
-DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-DATABASE_NAME = PROJECT_ROOT + '/dev.sqlite' # Or path to database file if using sqlite3.
-DATABASE_USER = '' # Not used with sqlite3.
-DATABASE_PASSWORD = '' # Not used with sqlite3.
-DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
-DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+ 'NAME': path.join(PROJECT_ROOT, 'dev.sqlite'), # Or path to database file if using sqlite3.
+ 'USER': '', # Not used with sqlite3.
+ 'PASSWORD': '', # Not used with sqlite3.
+ 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
+ 'PORT': '', # Set to empty string for default. Not used with sqlite3.
+ }
+}
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
-TIME_ZONE = 'Europe/Warsaw Poland'
+TIME_ZONE = None
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/admin-media/'
-# List of callables that know how to import templates from various sources.
-TEMPLATE_LOADERS = (
- 'django.template.loaders.filesystem.load_template_source',
- 'django.template.loaders.app_directories.load_template_source',
-# 'django.template.loaders.eggs.load_template_source',
-)
-
-TEMPLATE_CONTEXT_PROCESSORS = (
- "django.core.context_processors.auth",
- "django.core.context_processors.debug",
- "django.core.context_processors.i18n",
- 'django.core.context_processors.media',
- "django.core.context_processors.request",
-)
-
-
-MIDDLEWARE_CLASSES = (
- 'django.middleware.common.CommonMiddleware',
- 'django.contrib.sessions.middleware.SessionMiddleware',
- 'django.contrib.auth.middleware.AuthenticationMiddleware',
- 'django.middleware.doc.XViewMiddleware',
-)
-
ROOT_URLCONF = 'cas.urls'
TEMPLATE_DIRS = (
'django.contrib.admindocs',
'cas_provider',
+ 'gravatar',
+ 'south',
+
'accounts',
)
# django-cas-provider settings
LOGIN_URL = '/cas/login/'
LOGOUT_URL = '/cas/logout/'
+LOGIN_REDIRECT_URL = '/accounts/'
CAS_CUSTOM_ATTRIBUTES_CALLBACK = 'cas.utils.custom_attributes_callback'
SESSION_COOKIE_NAME = 'fnpcas'
+GRAVATAR_DEFAULT_IMAGE = 'mm'
+
# Import localsettings file, which may override settings defined here
try:
from localsettings import *
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
+<!DOCTYPE html>
+<html>
<head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <title>{% block title %}Fundacja Nowoczesna Polska - CAS{% block subtitle %}{% endblock subtitle %}{% endblock title%}</title>
- <link rel="stylesheet" href="{{ MEDIA_URL }}static/css/main.css"/>
+ <meta charset="utf-8" />
+ <title>{% block title %}Fundacja Nowoczesna Polska - Logowanie{% block subtitle %}{% endblock subtitle %}{% endblock title%}</title>
+ <link rel="stylesheet" href="{{ MEDIA_URL }}static/css/main.css"/>
{% block extrahead %}
{% endblock %}
</head>
<body>
- <div id="content_wrap"><div id="content">{% block content %} {% endblock %}</div></div>
- </body>
+ <div id="header-wrap">
+ <header>
+
+ <a href="/">
+ <img title="Fundacja Nowoczesna Polska"
+ alt="Fundacja Nowoczesna Polska"
+ src="http://turniej.wolnelektury.pl/static/img/fnp_black.png"></a>
+
+ </header>
+ </div>
+
+ <div id="content-wrap">
+ <div id="content">
+ {% block content %} {% endblock %}
+ </div>
+ </div>
+
</html>
{% block content %}
- <form action='{% url cas_login %}' method='post'>
+<div class="enclose">
+ <form class="enclosed" id="login-form" action='{% url "cas_login" %}' method='post'>
+ {% csrf_token %}
<h1>{% trans "Login" %}</h1>
{% for error in errors %}
<p>{{ error }}</p>
{% endfor %}
- <table>
- {{ form.as_table }}
- <tr><td><input type="submit" value="{% trans "Login me in" %}"/></td></tr>
- </table>
+ {{ form.as_p }}
+ <input type="submit" value="{% trans 'Login me in' %}" tabindex="10" />
</form>
+</div>
- {% include "horizontal_footer.html" %}
{% endblock %}
{% endblock %}
{% block content %}
+
+<div class="enclose"><div class="enclosed">
+
<h1>{% trans "Logged out" %}</h1>
<p>{% blocktrans %}You have successfully logged out. To ensure that you are logged out of all services, please close your browser.{% endblocktrans %}</p>
<p>{% blocktrans %}You can return to service you came from: <a href="{{ url }}">{{ url }}</a>{% endblocktrans %}</p>
{% endif %}
- {% url cas_provider.views.login as login_url %}
+ {% url 'cas_login' as login_url %}
<p>{% blocktrans %}You can also <a href="{{ login_url }}">login again</a>{% endblocktrans %}</p>
- {% include "horizontal_footer.html" %}
-{% endblock %}
\ No newline at end of file
+</div></div>
+{% endblock %}
+++ /dev/null
-<hr />
-<p>
- <a href="http://redakcja.wolnelektury.pl/" >
- <img src="{{ MEDIA_URL }}static/platforma.png" class="small_logo">
- </a>
-</p>
# -*- coding: utf-8 -*-
-from django.conf.urls.defaults import *
-from django.views.generic.simple import redirect_to
+from django.conf.urls import include, patterns, url
+from django.views.generic import RedirectView
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
urlpatterns = patterns('',
- url(r'^$', redirect_to, {'url': '/accounts/'}),
+ url(r'^$', RedirectView.as_view(url='/accounts/')),
# django-cas-provider
url(r'^cas/', include('cas_provider.urls')),