--- /dev/null
+O projekcie
+-----------
+
+CAS to aplikacja WWW służąca do uwierzytelniania (a w przyszłości również autoryzacji) użytkowników
+serwisów Fundacji Nowoczesna Polska. Implementuje on protokół CAS <http://www.jasig.org/cas> w
+wersji 1.0.
+
+Wymagania
+---------
+
+* Django 1.1 <http://djangoproject.com/>
+* zuber/django-cas-provider <http://github.com/zuber/django-cas-provider>
+
+Instalacja i uruchomienie
+-------------------------
+
+1. Ściągnij i zainstaluj pip <http://pypi.python.org/pypi/pip>
+2. Przejdź do katalogu aplikacji w konsoli
+3. Zainstaluj wymagane biblioteki (patrz sekcja wymagania_) komendą
+
+ pip install -r requirements.txt
+
+4. Wypełnij bazę danych (Django poprosi o utworzenie pierwszego użytkownika)
+
+ ./manage.py syncdb
+
+5. Uruchom serwer deweloperski
+
+ ./manage.py runserver
+
+6. Przy wdrożeniu będziesz musiał najpewniej utworzyć plik `localsettings.py` i wpisać tam
+ustawienia używanej bazy danych. Zalecane jest serwowanie aplikacji przez modwsgi na serwerze Apache2.
\ No newline at end of file
+++ /dev/null
-================================
-Fundacja Nowoczesna Polska - CAS
-================================
-
-O projekcie
-===========
-CAS to aplikacja WWW służąca do autentykacji (a w przyszłości również autoryzacji) użytkowników
-serwisów Fundacji Nowoczesna Polska. Implementuje on protokół `CAS <http://www.jasig.org/cas>`_ w
-wersji 1.0.
-
-Wymagania
-=========
-* `Django 1.1 <http://djangoproject.com/>`_
-* `zuber/django-cas-provider <http://github.com/zuber/django-cas-provider>`_
-
-Instalacja i uruchomienie
-=========================
-1. Ściągnij i zainstaluj `pip <http://pypi.python.org/pypi/pip>`_
-2. Przejdź do katalogu aplikacji w konsoli
-3. Zainstaluj wymagane biblioteki (patrz sekcja wymagania_) komendą::
-
- pip install -r requirements.txt
-
-4. Wypełnij bazę danych (Django poprosi o utworzenie pierwszego użytkownika)::
-
- ./manage.py syncdb
-
-5. Uruchom serwer deweloperski::
-
- ./manage.py runserver
-
-6. Przy wdrożeniu będziesz musiał najpewniej utworzyć plik `localsettings.py` i wpisać tam
-ustawienia używanej bazy danych. Zalecane jest serwowanie aplikacji
-przez `modwsgi <http://code.google.com/p/modwsgi/>`_ na serwerze `Apache2 <http://httpd.apache.org/>`_
-przy pomocy załączonego skryptu `dispatch.fcgi`. Inne strategie wdrożeniowe opisane
-są w `Dokumentacji Django <http://docs.djangoproject.com/en/dev/howto/deployment/#howto-deployment-index>`_.
\ No newline at end of file
--- /dev/null
+<VirtualHost *:80>
+ ServerName $DOMAIN
+ ServerAlias $DOMAIN_ALIASES
+
+ ServerAdmin $ADMIN_EMAIL
+
+ Alias /robots.txt $MEDIA_ROOT/static/robots.txt
+ Alias /favicon.ico $MEDIA_ROOT/static/favicon.ico
+
+ Alias /media/ $MEDIA_ROOT
+
+ #
+ # Logs
+ LogLevel info
+
+ #
+ # WSGI configuration follows
+ #
+
+ WSGIDaemonProcess $PROJECT_NAME processes=2 threads=1 user=$WSGI_USER group=$WSGI_USER display-name=%{GROUP}
+ WSGIProcessGroup $PROJECT_NAME
+ WSGIScriptAlias / $WSGI_TARGET
+
+ <Directory $WSGI_DIR>
+ Order allow,deny
+ Allow from all
+ </Directory>
+
+ <Location /media>
+ # Insert filter
+ SetOutputFilter DEFLATE
+
+ # Don't compress images
+ SetEnvIfNoCase Request_URI \
+ \.(?:xsl|xml|json|gif|jpe?g|png)$ no-gzip dont-vary
+ </Location>
+
+ <Directory $MEDIA_ROOT >
+ Order allow,deny
+ Allow from all
+ </Directory>
+
+ #<Directory $MEDIA_ROOT/static >
+ # Header unset ETag
+ # FileETag None
+ # ExpiresActive On
+ # ExpiresDefault "now plus 1 year"
+ #</Directory>
+
+</VirtualHost>
+
\ No newline at end of file
-#!%(python)s
+#!$PYTHON
import site
-site.addsitedir('%(path)s/lib/python2.5/site-packages')
+site.addsitedir('$PYTHON_SITE')
import os
from os.path import abspath, dirname, join
# Add apps and lib directories to PYTHONPATH
sys.path = [
- '%(path)s/releases/current/%(project_name)s',
- '%(path)s/releases/current/provider',
- '%(path)s/releases/current',
+ '$PROJECT_ROOT/src',
+ '$PROJECT_ROOT/provider',
] + sys.path
# Run Django
-os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
+os.environ['DJANGO_SETTINGS_MODULE'] = '$PROJECT_NAME.settings'
from django.core.handlers.wsgi import WSGIHandler
application = WSGIHandler()
+++ /dev/null
-[loggers]
-keys=root,fnp
-
-[handlers]
-keys=console,lf
-
-[formatters]
-keys=default
-
-[logger_root]
-level=DEBUG
-handlers=console
-
-[logger_fnp]
-level=DEBUG
-handlers=lf,console
-qualname=fnp
-propagate=0
-
-[formatter_default]
-format=%(asctime)s %(name)s/%(levelname)s :: %(module)s:%(lineno)d :: %(message)s
-datefmt=
-
-[handler_console]
-class=StreamHandler
-level=DEBUG
-formatter=default
-args=(sys.stderr, )
-
-[handler_lf]
-class=FileHandler
-level=DEBUG
-formatter=default
-args=("/var/services/logs/cas.log",)
\ No newline at end of file
+++ /dev/null
-#!/usr/bin/env python
-from django.core.management import execute_manager
-
-from os import path
-import sys
-
-PROJECT_ROOT = path.realpath(path.dirname(__file__))
-sys.path.insert(0, path.abspath(path.join(PROJECT_ROOT, "..", "provider")))
-print sys.path
-
-try:
- import settings # Assumed to be in the same directory.
-except ImportError:
- import traceback
- traceback.print_exc(file =sys.stderr)
- sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
- sys.exit(1)
-
-if __name__ == "__main__":
- # Append lib and apps directories to PYTHONPATH
-
-
- execute_manager(settings)
+++ /dev/null
-# -*- coding: utf-8 -*-
-from os import path
-
-PROJECT_ROOT = path.realpath(path.dirname(__file__))
-
-DEBUG = True
-TEMPLATE_DEBUG = DEBUG
-
-ADMINS = []
-
-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.
-
-# 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'
-
-# Language code for this installation. All choices can be found here:
-# http://www.i18nguy.com/unicode/language-identifiers.html
-LANGUAGE_CODE = 'pl'
-
-SITE_ID = 1
-
-# If you set this to False, Django will make some optimizations so as not
-# to load the internationalization machinery.
-USE_I18N = True
-
-# Absolute path to the directory that holds media.
-# Example: "/home/media/media.lawrence.com/"
-MEDIA_ROOT = PROJECT_ROOT + '/media/'
-STATIC_ROOT = PROJECT_ROOT + '/static/'
-
-# URL that handles the media served from MEDIA_ROOT. Make sure to use a
-# trailing slash if there is a path component (optional in other cases).
-# Examples: "http://media.lawrence.com", "http://example.com/media/"
-MEDIA_URL = '/media/'
-STATIC_URL = '/static/'
-
-# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
-# trailing slash.
-# 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.request",
-)
-
-
-MIDDLEWARE_CLASSES = (
- 'django.middleware.common.CommonMiddleware',
- 'django.contrib.sessions.middleware.SessionMiddleware',
- 'django.contrib.auth.middleware.AuthenticationMiddleware',
- 'django.middleware.doc.XViewMiddleware',
-)
-
-ROOT_URLCONF = 'urls'
-
-TEMPLATE_DIRS = (
- PROJECT_ROOT + '/templates',
-)
-
-INSTALLED_APPS = (
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.sites',
- 'django.contrib.admin',
- 'django.contrib.admindocs',
-
- 'cas_provider',
-)
-
-# django-cas-provider settings
-LOGIN_URL = '/cas/login/'
-LOGOUT_URL = '/cas/logout/'
-CAS_CUSTOM_ATTRIBUTES_CALLBACK = 'utils.custom_attributes_callback'
-SESSION_COOKIE_NAME = 'fnpcas_sessionid'
-
-# Python logging settings
-import logging
-import logging.config
-logging.config.fileConfig(path.join(PROJECT_ROOT, "logging.cfg"))
-
-# Import localsettings file, which may override settings defined here
-try:
- from localsettings import *
-except ImportError:
- pass
+++ /dev/null
-{% extends "cas_base.html" %}
-
-{% block content %}
- <form action='.' method='post'>
- <fieldset>
- <legend>Zaloguj się</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 %}
-
\ No newline at end of file
+++ /dev/null
-{% extends "cas_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 %}
\ No newline at end of file
+++ /dev/null
-<!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">
- <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>
- {% block extrahead %}
- {% endblock %}
- </head>
- <body id="{% block bodyid %}base{% endblock %}">
- <div id="content">{% block content %} {% endblock %}</div>
- </body>
-</html>
+++ /dev/null
-# -*- coding: utf-8 -*-
-from django.conf.urls.defaults import *
-from django.contrib import admin
-from django.conf import settings
-
-admin.autodiscover()
-
-urlpatterns = patterns('',
- # Admin panel
- url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
- url(r'^admin/(.*)', admin.site.root),
-
- # django-cas-provider
- url(r'^', include('cas_provider.urls')),
-)
-
-
+++ /dev/null
-def custom_attributes_callback(user):
- return {
- 'email': user.email,
- 'firstname': user.first_name,
- 'lastname': user.last_name,
- }
+++ /dev/null
-from __future__ import with_statement # needed for python 2.5
-from fabric.api import *
-from fabric.contrib import files
-
-import os
-
-
-# ==========
-# = Config =
-# ==========
-# Globals
-env.project_name = 'cas'
-env.use_south = False
-
-# Servers
-def staging():
- """Use staging server"""
- env.hosts = ['stigma.nowoczesnapolska.org.pl:2222']
- env.user = 'platforma'
- env.path = '/var/services/cas'
- env.python = '/usr/bin/python'
- env.virtualenv = '/usr/bin/virtualenv'
- env.pip = '/usr/bin/pip'
-
-def production():
- """Use production server"""
- env.hosts = ['wolnelektury.pl:22123']
- env.user = 'fundacja'
- env.path = '/opt/lektury/cas'
- env.python = '/opt/lektury/basevirtualenv/bin/python'
- env.virtualenv = '/opt/lektury/basevirtualenv/bin/virtualenv'
- env.pip = '/opt/lektury/basevirtualenv/bin/pip'
-
-
-# =========
-# = Tasks =
-# =========
-def test():
- "Run the test suite and bail out if it fails"
- require('hosts', 'path', provided_by=[staging, production])
- result = run('cd %(path)s/%(project_name)s; %(python)s manage.py test' % env)
-
-def setup():
- """
- Setup a fresh virtualenv as well as a few useful directories, then run
- a full deployment. virtualenv and pip should be already installed.
- """
- require('hosts', 'path', provided_by=[staging, production])
-
- run('mkdir -p %(path)s; cd %(path)s; %(virtualenv)s --no-site-packages .;' % env, pty=True)
- run('cd %(path)s; mkdir releases; mkdir shared; mkdir packages;' % env, pty=True)
- run('cd %(path)s/releases; ln -s . current; ln -s . previous' % env, pty=True)
- deploy()
-
-def deploy():
- """
- Deploy the latest version of the site to the servers,
- install any required third party modules,
- install the virtual host and then restart the webserver
- """
- require('hosts', 'path', provided_by=[staging, production])
-
- import time
- env.release = time.strftime('%Y-%m-%dT%H%M')
-
- upload_tar_from_git()
- upload_wsgi_script()
- # upload_vhost_sample()
- install_requirements()
- copy_localsettings()
- symlink_current_release()
- migrate()
- restart_webserver()
-
-def deploy_version(version):
- "Specify a specific version to be made live"
- require('hosts', 'path', provided_by=[localhost,webserver])
- env.version = version
- with cd(env.path):
- run('rm releases/previous; mv releases/current releases/previous;', pty=True)
- run('ln -s %(version)s releases/current' % env, pty=True)
- restart_webserver()
-
-def rollback():
- """
- Limited rollback capability. Simple loads the previously current
- version of the code. Rolling back again will swap between the two.
- """
- require('hosts', provided_by=[staging, production])
- require('path')
- with cd(env.path):
- run('mv releases/current releases/_previous;', pty=True)
- run('mv releases/previous releases/current;', pty=True)
- run('mv releases/_previous releases/previous;', pty=True)
- restart_webserver()
-
-
-# =====================================================================
-# = Helpers. These are called by other functions rather than directly =
-# =====================================================================
-def upload_tar_from_git():
- "Create an archive from the current Git master branch and upload it"
- print '>>> upload tar from git'
- require('release', provided_by=[deploy])
- local('git archive --format=tar master | gzip > %(release)s.tar.gz' % env)
- run('mkdir -p %(path)s/releases/%(release)s' % env, pty=True)
- run('mkdir -p %(path)s/packages' % env, pty=True)
- put('%(release)s.tar.gz' % env, '%(path)s/packages/' % env)
- run('cd %(path)s/releases/%(release)s && tar zxf ../../packages/%(release)s.tar.gz' % env, pty=True)
- local('rm %(release)s.tar.gz' % env)
-
-def upload_vhost_sample():
- "Create and upload Apache virtual host configuration sample"
- print ">>> upload vhost sample"
- files.upload_template('%(project_name)s.vhost.template' % env, '%(path)s/%(project_name)s.vhost.sample' % env, context=env)
-
-def upload_wsgi_script():
- "Create and upload a wsgi script sample"
- print ">>> upload wsgi script sample"
- files.upload_template('%(project_name)s.wsgi.template' % env, '%(path)s/%(project_name)s.wsgi' % env, context=env)
- run('chmod ug+x %(path)s/%(project_name)s.wsgi' % env)
-
-def install_requirements():
- "Install the required packages from the requirements file using pip"
- print '>>> install requirements'
- require('release', provided_by=[deploy])
- run('cd %(path)s; %(pip)s install -E . -r %(path)s/releases/%(release)s/requirements.txt' % env, pty=True)
-
-def copy_localsettings():
- "Copy localsettings.py from root directory to release directory (if this file exists)"
- print ">>> copy localsettings"
- require('release', provided_by=[deploy])
- require('path', provided_by=[staging, production])
-
- with settings(warn_only=True):
- run('cp %(path)s/localsettings.py %(path)s/releases/%(release)s/%(project_name)s' % env)
-
-def symlink_current_release():
- "Symlink our current release"
- print '>>> symlink current release'
- require('release', provided_by=[deploy])
- require('path', provided_by=[staging, production])
- with cd(env.path):
- run('rm releases/previous; mv releases/current releases/previous')
- run('ln -s %(release)s releases/current' % env)
-
-def migrate():
- "Update the database"
- print '>>> migrate'
- require('project_name', provided_by=[staging, production])
- with cd('%(path)s/releases/current/%(project_name)s' % env):
- run('../../../bin/python manage.py syncdb --noinput' % env, pty=True)
- if env.use_south:
- run('../../../bin/python manage.py migrate' % env, pty=True)
-
-def restart_webserver():
- "Restart the web server"
- print '>>> restart webserver'
- run('touch %(path)s/releases/current/%(project_name)s/%(project_name)s.wsgi' % env)
--- /dev/null
+[loggers]
+keys=root,fnp
+
+[handlers]
+keys=console,lf
+
+[formatters]
+keys=default
+
+[logger_root]
+level=DEBUG
+handlers=console
+
+[logger_fnp]
+level=DEBUG
+handlers=lf,console
+qualname=fnp
+propagate=0
+
+[formatter_default]
+format=%(asctime)s %(name)s/%(levelname)s :: %(module)s:%(lineno)d :: %(message)s
+datefmt=
+
+[handler_console]
+class=StreamHandler
+level=DEBUG
+formatter=default
+args=(sys.stderr, )
+
+[handler_lf]
+class=FileHandler
+level=DEBUG
+formatter=default
+args=("/var/services/logs/cas.log",)
\ No newline at end of file
--- /dev/null
+#!/usr/bin/env python
+from django.core.management import execute_manager
+
+from os import path
+import sys
+
+PROJECT_ROOT = path.realpath(path.dirname(__file__))
+sys.path.insert(0, path.abspath(path.join(PROJECT_ROOT, "..", "provider")))
+print sys.path
+
+try:
+ import settings # Assumed to be in the same directory.
+except ImportError:
+ import traceback
+ traceback.print_exc(file =sys.stderr)
+ sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
+ sys.exit(1)
+
+if __name__ == "__main__":
+ # Append lib and apps directories to PYTHONPATH
+
+
+ execute_manager(settings)
--- /dev/null
+# -*- coding: utf-8 -*-
+from os import path
+
+PROJECT_ROOT = path.realpath(path.dirname(__file__))
+
+DEBUG = True
+TEMPLATE_DEBUG = DEBUG
+
+ADMINS = []
+
+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.
+
+# 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'
+
+# Language code for this installation. All choices can be found here:
+# http://www.i18nguy.com/unicode/language-identifiers.html
+LANGUAGE_CODE = 'pl'
+
+SITE_ID = 1
+
+# If you set this to False, Django will make some optimizations so as not
+# to load the internationalization machinery.
+USE_I18N = True
+
+# Absolute path to the directory that holds media.
+# Example: "/home/media/media.lawrence.com/"
+MEDIA_ROOT = PROJECT_ROOT + '/media/'
+STATIC_ROOT = PROJECT_ROOT + '/static/'
+
+# URL that handles the media served from MEDIA_ROOT. Make sure to use a
+# trailing slash if there is a path component (optional in other cases).
+# Examples: "http://media.lawrence.com", "http://example.com/media/"
+MEDIA_URL = '/media/'
+STATIC_URL = '/static/'
+
+# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
+# trailing slash.
+# 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.request",
+)
+
+
+MIDDLEWARE_CLASSES = (
+ 'django.middleware.common.CommonMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.middleware.doc.XViewMiddleware',
+)
+
+ROOT_URLCONF = 'urls'
+
+TEMPLATE_DIRS = (
+ PROJECT_ROOT + '/templates',
+)
+
+INSTALLED_APPS = (
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.sites',
+ 'django.contrib.admin',
+ 'django.contrib.admindocs',
+
+ 'cas_provider',
+)
+
+# django-cas-provider settings
+LOGIN_URL = '/cas/login/'
+LOGOUT_URL = '/cas/logout/'
+CAS_CUSTOM_ATTRIBUTES_CALLBACK = 'utils.custom_attributes_callback'
+SESSION_COOKIE_NAME = 'fnpcas'
+
+# Python logging settings
+import logging
+import logging.config
+logging.config.fileConfig(path.join(PROJECT_ROOT, "logging.cfg"))
+
+# Import localsettings file, which may override settings defined here
+try:
+ from localsettings import *
+except ImportError:
+ pass
--- /dev/null
+{% extends "cas_base.html" %}
+
+{% block content %}
+ <form action='.' method='post'>
+ <fieldset>
+ <legend>Zaloguj się</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 %}
+
\ No newline at end of file
--- /dev/null
+{% extends "cas_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 %}
\ No newline at end of file
--- /dev/null
+<!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">
+ <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>
+ {% block extrahead %}
+ {% endblock %}
+ </head>
+ <body id="{% block bodyid %}base{% endblock %}">
+ <div id="content">{% block content %} {% endblock %}</div>
+ </body>
+</html>
--- /dev/null
+# -*- coding: utf-8 -*-
+from django.conf.urls.defaults import *
+from django.contrib import admin
+from django.conf import settings
+
+admin.autodiscover()
+
+urlpatterns = patterns('',
+ # Admin panel
+ url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
+ url(r'^admin/(.*)', admin.site.root),
+
+ # django-cas-provider
+ url(r'^', include('cas_provider.urls')),
+)
+
+
--- /dev/null
+def custom_attributes_callback(user):
+ return {
+ 'email': user.email,
+ 'firstname': user.first_name,
+ 'lastname': user.last_name,
+ }