Sergey Maranchuk avatar Sergey Maranchuk committed b0e654e

close #57: update example app to django 1.4 and openid-selector to 1.3

Comments (0)

Files changed (213)

Add a comment to this file

example/__init__.py

Empty file removed.

Add a comment to this file

example/example/__init__.py

Empty file added.

example/example/settings.py

+# -*- coding: utf-8 -*-
+# Django settings for example project.
+import os
+
+PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
+DEBUG = True
+TEMPLATE_DEBUG = DEBUG
+
+ADMINS = (
+        ('Benoit Chesneau', 'bchesneau@gmail.com'),
+)
+
+MANAGERS = ADMINS
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
+        'NAME': 'test.db',                      # 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.
+# On Unix systems, a value of None will cause Django to use the same
+# timezone as the operating system.
+# If running in a Windows environment this must be set to the same as your
+# system time zone.
+TIME_ZONE = 'America/Chicago'
+
+# Language code for this installation. All choices can be found here:
+# http://www.i18nguy.com/unicode/language-identifiers.html
+LANGUAGE_CODE = 'en-us'
+
+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
+
+# If you set this to False, Django will not format dates, numbers and
+# calendars according to the current locale.
+USE_L10N = True
+
+# If you set this to False, Django will not use timezone-aware datetimes.
+USE_TZ = True
+
+# Absolute filesystem path to the directory that will hold user-uploaded files.
+# Example: "/home/media/media.lawrence.com/media/"
+MEDIA_ROOT = ''
+
+# URL that handles the media served from MEDIA_ROOT. Make sure to use a
+# trailing slash.
+# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
+MEDIA_URL = ''
+
+# Absolute path to the directory static files should be collected to.
+# Don't put anything in this directory yourself; store your static files
+# in apps' "static/" subdirectories and in STATICFILES_DIRS.
+# Example: "/home/media/media.lawrence.com/static/"
+STATIC_ROOT = ''
+
+# URL prefix for static files.
+# Example: "http://media.lawrence.com/static/"
+STATIC_URL = '/static/'
+
+# Additional locations of static files
+STATICFILES_DIRS = (
+    os.path.join(PROJECT_PATH, 'static'),
+)
+
+# List of finder classes that know how to find static files in
+# various locations.
+STATICFILES_FINDERS = (
+    'django.contrib.staticfiles.finders.FileSystemFinder',
+    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
+#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
+)
+
+# Make this unique, and don't share it with anybody.
+SECRET_KEY = '(g2ob^ac*qi%wv@m)v^y6%_dz=mbfa#egq6k47)kj)sfgzy@55'
+
+# List of callables that know how to import templates from various sources.
+TEMPLATE_LOADERS = (
+    'django.template.loaders.filesystem.Loader',
+    'django.template.loaders.app_directories.Loader',
+#     'django.template.loaders.eggs.Loader',
+)
+
+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_authopenid.context_processors.authopenid',
+)
+
+MIDDLEWARE_CLASSES = (
+    'django.middleware.common.CommonMiddleware',
+    'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.middleware.csrf.CsrfViewMiddleware',
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
+    'django.contrib.messages.middleware.MessageMiddleware',
+    'django_authopenid.middleware.OpenIDMiddleware',
+    # Uncomment the next line for simple clickjacking protection:
+    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
+)
+
+ROOT_URLCONF = 'example.urls'
+
+# Python dotted path to the WSGI application used by Django's runserver.
+WSGI_APPLICATION = 'example.wsgi.application'
+
+TEMPLATE_DIRS = (
+    os.path.join(PROJECT_PATH, 'templates'),
+)
+
+INSTALLED_APPS = (
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.sites',
+    'django.contrib.messages',
+    'django.contrib.staticfiles',
+    'django.contrib.admin',
+    'registration',
+    'django_authopenid', 
+)
+
+# A sample logging configuration. The only tangible logging
+# performed by this configuration is to send an email to
+# the site admins on every HTTP 500 error when DEBUG=False.
+# See http://docs.djangoproject.com/en/dev/topics/logging for
+# more details on how to customize your logging configuration.
+LOGGING = {
+    'version': 1,
+    'disable_existing_loggers': False,
+    'filters': {
+        'require_debug_false': {
+            '()': 'django.utils.log.RequireDebugFalse'
+        }
+    },
+    'handlers': {
+        'mail_admins': {
+            'level': 'ERROR',
+            'filters': ['require_debug_false'],
+            'class': 'django.utils.log.AdminEmailHandler'
+        }
+    },
+    'loggers': {
+        'django.request': {
+            'handlers': ['mail_admins'],
+            'level': 'ERROR',
+            'propagate': True,
+        },
+    }
+}
+
+LOGIN_REDIRECT_URL = '/'
+ACCOUNT_ACTIVATION_DAYS = 10
+
+OPENID_SREG = {
+    "required": ['fullname', 'country']
+}
+
+EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

example/example/static/css/base.css

+body { 
+    background-color: #fff; 
+    color: #333; 
+}
+ 
+body, p, ol, ul, td {
+  font-family: verdana, arial, helvetica, sans-serif;
+  font-size:   13px;
+  line-height: 18px;
+}
+ 
+pre {
+  background-color: #eee;
+  padding: 10px;
+  font-size: 11px;
+}
+ 
+a { color: #000; }
+a:visited { color: #666; }
+a:hover { color: #fff; background-color:#000; }
+ 
+div.errors,
+li.errors,
+ul.errorlist li {
+    background-color: #ff9898;
+    padding: 0.3em;
+    border-color:#ff0000;
+    padding: 0.3em;
+    border: 1px solid;
+}
+
+ul.errorlist,
+ul.errorlist li {
+    margin: 0;
+    list-style: none;
+    float: right;
+}
+.login {
+    width: 800px;
+    clear: both;
+}
+
+footer#bottom {
+    display: block;
+    width: 100%;
+    clear: both;
+    padding-top: 20px;
+}
+
+#bottom p {
+    width: 500px;
+}
+
+header#top {
+    display: block;
+    width: 100%;
+    height: 40px;
+    margin-bottom: 15px;
+    clear: both;
+}
+
+#auth_form {
+    display: block;
+    width: 220px;
+    float: left;
+    margin-right: 10px;
+}
+
+span.error {
+    color: red;
+}

example/example/static/css/openid-shadow.css

+/*
+	Simple OpenID Plugin
+	http://code.google.com/p/openid-selector/
+	
+	This code is licensed under the New BSD License.
+*/
+
+#openid_form {
+	width: 590px;
+}
+
+#openid_form legend {
+	font-weight: bold;
+}
+
+#openid_choice {
+	display: none;
+}
+
+#openid_input_area {
+	clear: both;
+	padding: 10px;
+}
+
+#openid_btns, #openid_btns br {
+	clear: both;
+}
+
+#openid_highlight {
+	padding: 3px;
+	background-color: #FFFCC9;
+	float: left;
+}
+
+.openid_large_btn {
+	width: 100px;
+	height: 60px;
+/* fix for IE 6 only: http://en.wikipedia.org/wiki/CSS_filter#Underscore_hack */
+	_width: 104px;
+	_height: 64px;
+
+	border: 2px solid #DDD;
+	border-right: 2px solid #ccc;
+	border-bottom: 2px solid #ccc;
+	margin: 3px;
+	float: left;
+	border-radius: 5px;	
+	-moz-border-radius: 5px;
+	-webkit-border-radius: 5px;
+	box-shadow: 2px 2px 4px #ddd;
+	-moz-box-shadow: 2px 2px 4px #ddd;
+	-webkit-box-shadow: 2px 2px 4px #ddd;
+}
+
+.openid_large_btn:hover {
+	margin: 4px 0 0 6px;
+	border: 2px solid #999;
+	box-shadow: none;
+	-moz-box-shadow: none;
+	-webkit-box-shadow: none;
+}
+
+.openid_small_btn {
+	width: 24px;
+	height: 24px;
+/* fix for IE 6 only: http://en.wikipedia.org/wiki/CSS_filter#Underscore_hack */
+	_width: 28px;
+	_height: 28px;
+
+	border: 2px solid #DDD;
+	border-right: 2px solid #ccc;
+	border-bottom: 2px solid #ccc;
+	margin: 3px;
+	float: left;
+	border-radius: 5px;	
+	-moz-border-radius: 5px;
+	-webkit-border-radius: 5px;
+	box-shadow: 2px 2px 4px #ddd;
+	-moz-box-shadow: 2px 2px 4px #ddd;
+	-webkit-box-shadow: 2px 2px 4px #ddd;
+}
+
+.openid_small_btn:hover {
+	margin: 4px 0 0 6px;
+	border: 2px solid #999;
+	box-shadow: none;
+	-moz-box-shadow: none;
+	-webkit-box-shadow: none;
+}
+
+a.openid_large_btn:focus {
+	outline: none;
+}
+
+a.openid_large_btn:focus {
+	-moz-outline-style: none;
+}
+
+.openid_selected {
+	border: 4px solid #DDD;
+}

example/example/static/css/openid.css

+/*
+	Simple OpenID Plugin
+	http://code.google.com/p/openid-selector/
+	
+	This code is licensed under the New BSD License.
+*/
+
+#openid_form {
+	display:block;
+}
+
+#openid_form legend {
+	font-weight: bold;
+}
+
+#openid_choice {
+	display: none;
+}
+
+#openid_input_area {
+	clear: both;
+	padding: 10px;
+}
+
+#openid_btns, #openid_btns br {
+	clear: both;
+}
+
+#openid_highlight {
+	padding: 3px;
+	background-color: #FFFCC9;
+	float: left;
+}
+
+.openid_large_btn {
+	width: 100px;
+	height: 60px;
+/* fix for IE 6 only: http://en.wikipedia.org/wiki/CSS_filter#Underscore_hack */
+	_width: 102px;
+	_height: 62px;
+
+	border: 1px solid #DDD;
+	margin: 3px;
+	float: left;
+}
+
+.openid_small_btn {
+	width: 24px;
+	height: 24px;
+/* fix for IE 6 only: http://en.wikipedia.org/wiki/CSS_filter#Underscore_hack */
+	_width: 26px;
+	_height: 26px;
+
+	border: 1px solid #DDD;
+	margin: 3px;
+	float: left;
+}
+
+a.openid_large_btn:focus {
+	outline: none;
+}
+
+a.openid_large_btn:focus {
+	-moz-outline-style: none;
+}
+
+.openid_selected {
+	border: 4px solid #DDD;
+}
Add a comment to this file

example/example/static/images.large/aol.gif

Added
New image
Add a comment to this file

example/example/static/images.large/facebook.gif

Added
New image
Add a comment to this file

example/example/static/images.large/google.gif

Added
New image
Add a comment to this file

example/example/static/images.large/mailru.gif

Added
New image
Add a comment to this file

example/example/static/images.large/myopenid.gif

Added
New image
Add a comment to this file

example/example/static/images.large/openid.gif

Added
New image
Add a comment to this file

example/example/static/images.large/rambler.gif

Added
New image
Add a comment to this file

example/example/static/images.large/verisign.gif

Added
New image
Add a comment to this file

example/example/static/images.large/vkontakte.gif

Added
New image
Add a comment to this file

example/example/static/images.large/yahoo.gif

Added
New image
Add a comment to this file

example/example/static/images.large/yandex.gif

Added
New image
Add a comment to this file

example/example/static/images.small/aol.ico

Added
New image
Add a comment to this file

example/example/static/images.small/aol.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/aol.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/blogger.ico

Added
New image
Add a comment to this file

example/example/static/images.small/blogger.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/blogger.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/claimid.ico

Added
New image
Add a comment to this file

example/example/static/images.small/claimid.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/claimid.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/clickpass.ico

Added
New image
Add a comment to this file

example/example/static/images.small/clickpass.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/clickpass.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/facebook.ico

Added
New image
Add a comment to this file

example/example/static/images.small/facebook.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/facebook.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/flickr.ico

Added
New image
Add a comment to this file

example/example/static/images.small/flickr.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/flickr.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/google.ico

Added
New image
Add a comment to this file

example/example/static/images.small/google.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/google.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/google_profile.ico

Added
New image
Add a comment to this file

example/example/static/images.small/google_profile.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/google_profile.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/launchpad.ico

Added
New image
Add a comment to this file

example/example/static/images.small/launchpad.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/launchpad.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/linkedin.ico

Added
New image
Add a comment to this file

example/example/static/images.small/linkedin.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/linkedin.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/livejournal.ico

Added
New image
Add a comment to this file

example/example/static/images.small/livejournal.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/livejournal.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/mailru.ico

Added
New image
Add a comment to this file

example/example/static/images.small/mailru.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/mailru.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/myopenid.ico

Added
New image
Add a comment to this file

example/example/static/images.small/myopenid.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/myopenid.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/openid.ico

Added
New image
Add a comment to this file

example/example/static/images.small/openid.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/openid.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/rambler.ico

Added
New image
Add a comment to this file

example/example/static/images.small/rambler.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/rambler.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/technorati.ico

Added
New image
Add a comment to this file

example/example/static/images.small/technorati.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/technorati.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/twitter.ico

Added
New image
Add a comment to this file

example/example/static/images.small/twitter.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/twitter.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/verisign.ico

Added
New image
Add a comment to this file

example/example/static/images.small/verisign.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/verisign.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/vidoop.ico

Added
New image
Add a comment to this file

example/example/static/images.small/vidoop.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/vidoop.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/vkontakte.ico

Added
New image
Add a comment to this file

example/example/static/images.small/vkontakte.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/vkontakte.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/winliveid.ico

Added
New image
Add a comment to this file

example/example/static/images.small/winliveid.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/winliveid.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/wordpress.ico

Added
New image
Add a comment to this file

example/example/static/images.small/wordpress.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/wordpress.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/yahoo.ico

Added
New image
Add a comment to this file

example/example/static/images.small/yahoo.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/yahoo.ico.png

Added
New image
Add a comment to this file

example/example/static/images.small/yandex.ico

Added
New image
Add a comment to this file

example/example/static/images.small/yandex.ico.gif

Added
New image
Add a comment to this file

example/example/static/images.small/yandex.ico.png

Added
New image
Add a comment to this file

example/example/static/images/openid-inputicon.gif

Added
New image
Add a comment to this file

example/example/static/images/openid-providers-en.png

Added
New image
Add a comment to this file

example/example/static/images/openid-providers-ru.png

Added
New image

example/example/static/js/openid-en.js

+/*
+	Simple OpenID Plugin
+	http://code.google.com/p/openid-selector/
+	
+	This code is licensed under the New BSD License.
+*/
+
+var providers_large = {
+	google : {
+		name : 'Google',
+		url : 'https://www.google.com/accounts/o8/id'
+	},
+	yahoo : {
+		name : 'Yahoo',
+		url : 'http://me.yahoo.com/'
+	},
+	aol : {
+		name : 'AOL',
+		label : 'Enter your AOL screenname.',
+		url : 'http://openid.aol.com/{username}'
+	},
+	myopenid : {
+		name : 'MyOpenID',
+		label : 'Enter your MyOpenID username.',
+		url : 'http://{username}.myopenid.com/'
+	},
+	openid : {
+		name : 'OpenID',
+		label : 'Enter your OpenID.',
+		url : null
+	}
+};
+
+var providers_small = {
+	livejournal : {
+		name : 'LiveJournal',
+		label : 'Enter your Livejournal username.',
+		url : 'http://{username}.livejournal.com/'
+	},
+	/* flickr: {
+		name: 'Flickr',        
+		label: 'Enter your Flickr username.',
+		url: 'http://flickr.com/{username}/'
+	}, */
+	/* technorati: {
+		name: 'Technorati',
+		label: 'Enter your Technorati username.',
+		url: 'http://technorati.com/people/technorati/{username}/'
+	}, */
+	wordpress : {
+		name : 'Wordpress',
+		label : 'Enter your Wordpress.com username.',
+		url : 'http://{username}.wordpress.com/'
+	},
+	blogger : {
+		name : 'Blogger',
+		label : 'Your Blogger account',
+		url : 'http://{username}.blogspot.com/'
+	},
+	verisign : {
+		name : 'Verisign',
+		label : 'Your Verisign username',
+		url : 'http://{username}.pip.verisignlabs.com/'
+	},
+	/* vidoop: {
+		name: 'Vidoop',
+		label: 'Your Vidoop username',
+		url: 'http://{username}.myvidoop.com/'
+	}, */
+	/* launchpad: {
+		name: 'Launchpad',
+		label: 'Your Launchpad username',
+		url: 'https://launchpad.net/~{username}'
+	}, */
+	claimid : {
+		name : 'ClaimID',
+		label : 'Your ClaimID username',
+		url : 'http://claimid.com/{username}'
+	},
+	clickpass : {
+		name : 'ClickPass',
+		label : 'Enter your ClickPass username',
+		url : 'http://clickpass.com/public/{username}'
+	},
+	google_profile : {
+		name : 'Google Profile',
+		label : 'Enter your Google Profile username',
+		url : 'http://www.google.com/profiles/{username}'
+	}
+};
+
+openid.locale = 'en';
+openid.sprite = 'en'; // reused in german& japan localization
+openid.demo_text = 'In client demo mode. Normally would have submitted OpenID:';
+openid.signin_text = 'Sign-In';
+openid.image_title = 'log in with {provider}';

example/example/static/js/openid-jquery.js

+/*
+	Simple OpenID Plugin
+	http://code.google.com/p/openid-selector/
+	
+	This code is licensed under the New BSD License.
+*/
+
+var providers;
+var openid;
+(function ($) {
+openid = {
+	version : '1.3', // version constant
+	demo : false,
+	demo_text : null,
+	cookie_expires : 6 * 30, // 6 months.
+	cookie_name : 'openid_provider',
+	cookie_path : '/',
+
+	img_path : '/static/images/',
+	locale : null, // is set in openid-<locale>.js
+	sprite : null, // usually equals to locale, is set in
+	// openid-<locale>.js
+	signin_text : null, // text on submit button on the form
+	all_small : false, // output large providers w/ small icons
+	no_sprite : false, // don't use sprite image
+	image_title : '{provider}', // for image title
+
+	input_id : null,
+	provider_url : null,
+	provider_id : null,
+
+	/**
+	 * Class constructor
+	 * 
+	 * @return {Void}
+	 */
+	init : function(input_id) {
+		providers = $.extend({}, providers_large, providers_small);
+		var openid_btns = $('#openid_btns');
+		this.input_id = input_id;
+		$('#openid_choice').show();
+		$('#openid_input_area').empty();
+		var i = 0;
+		// add box for each provider
+		for (id in providers_large) {
+			box = this.getBoxHTML(id, providers_large[id], (this.all_small ? 'small' : 'large'), i++);
+			openid_btns.append(box);
+		}
+		if (providers_small) {
+			openid_btns.append('<br/>');
+			for (id in providers_small) {
+				box = this.getBoxHTML(id, providers_small[id], 'small', i++);
+				openid_btns.append(box);
+			}
+		}
+		$('#openid_form').submit(this.submit);
+		var box_id = this.readCookie();
+		if (box_id) {
+			this.signin(box_id, true);
+		}
+	},
+
+	/**
+	 * @return {String}
+	 */
+	getBoxHTML : function(box_id, provider, box_size, index) {
+		if (this.no_sprite) {
+			var image_ext = box_size == 'small' ? '.ico.gif' : '.gif';
+			return '<a title="' + this.image_title.replace('{provider}', provider["name"]) + '" href="javascript:openid.signin(\'' + box_id + '\');"'
+					+ ' style="background: #FFF url(' + this.img_path + '../images.' + box_size + '/' + box_id + image_ext + ') no-repeat center center" '
+					+ 'class="' + box_id + ' openid_' + box_size + '_btn"></a>';
+		}
+		var x = box_size == 'small' ? -index * 24 : -index * 100;
+		var y = box_size == 'small' ? -60 : 0;
+		return '<a title="' + this.image_title.replace('{provider}', provider["name"]) + '" href="javascript:openid.signin(\'' + box_id + '\');"'
+				+ ' style="background: #FFF url(' + this.img_path + 'openid-providers-' + this.sprite + '.png); background-position: ' + x + 'px ' + y + 'px" '
+				+ 'class="' + box_id + ' openid_' + box_size + '_btn"></a>';
+	},
+
+	/**
+	 * Provider image click
+	 * 
+	 * @return {Void}
+	 */
+	signin : function(box_id, onload) {
+		var provider = providers[box_id];
+		if (!provider) {
+			return;
+		}
+		this.highlight(box_id);
+		this.setCookie(box_id);
+		this.provider_id = box_id;
+		this.provider_url = provider['url'];
+		// prompt user for input?
+		if (provider['label']) {
+			this.useInputBox(provider);
+		} else {
+			$('#openid_input_area').empty();
+			if (!onload) {
+				$('#openid_form').submit();
+			}
+		}
+	},
+
+	/**
+	 * Sign-in button click
+	 * 
+	 * @return {Boolean}
+	 */
+	submit : function() {
+		var url = openid.provider_url;
+		if (url) {
+			url = url.replace('{username}', $('#openid_username').val());
+			openid.setOpenIdUrl(url);
+		}
+		if (openid.demo) {
+			alert(openid.demo_text + "\r\n" + document.getElementById(openid.input_id).value);
+			return false;
+		}
+		if (url.indexOf("javascript:") == 0) {
+			url = url.substr("javascript:".length);
+			eval(url);
+			return false;
+		}
+		return true;
+	},
+
+	/**
+	 * @return {Void}
+	 */
+	setOpenIdUrl : function(url) {
+		var hidden = document.getElementById(this.input_id);
+		if (hidden != null) {
+			hidden.value = url;
+		} else {
+			$('#openid_form').append('<input type="hidden" id="' + this.input_id + '" name="' + this.input_id + '" value="' + url + '"/>');
+		}
+	},
+
+	/**
+	 * @return {Void}
+	 */
+	highlight : function(box_id) {
+		// remove previous highlight.
+		var highlight = $('#openid_highlight');
+		if (highlight) {
+			highlight.replaceWith($('#openid_highlight a')[0]);
+		}
+		// add new highlight.
+		$('.' + box_id).wrap('<div id="openid_highlight"></div>');
+	},
+
+	setCookie : function(value) {
+		var date = new Date();
+		date.setTime(date.getTime() + (this.cookie_expires * 24 * 60 * 60 * 1000));
+		var expires = "; expires=" + date.toGMTString();
+		document.cookie = this.cookie_name + "=" + value + expires + "; path=" + this.cookie_path;
+	},
+
+	readCookie : function() {
+		var nameEQ = this.cookie_name + "=";
+		var ca = document.cookie.split(';');
+		for ( var i = 0; i < ca.length; i++) {
+			var c = ca[i];
+			while (c.charAt(0) == ' ')
+				c = c.substring(1, c.length);
+			if (c.indexOf(nameEQ) == 0)
+				return c.substring(nameEQ.length, c.length);
+		}
+		return null;
+	},
+
+	/**
+	 * @return {Void}
+	 */
+	useInputBox : function(provider) {
+		var input_area = $('#openid_input_area');
+		var html = '';
+		var id = 'openid_username';
+		var value = '';
+		var label = provider['label'];
+		var style = '';
+		if (label) {
+			html = '<p>' + label + '</p>';
+		}
+		if (provider['name'] == 'OpenID') {
+			id = this.input_id;
+			value = 'http://';
+			style = 'background: #FFF url(' + this.img_path + 'openid-inputicon.gif) no-repeat scroll 0 50%; padding-left:18px;';
+		}
+		html += '<input id="' + id + '" type="text" style="' + style + '" name="' + id + '" value="' + value + '" />'
+				+ '<input id="openid_submit" type="submit" value="' + this.signin_text + '"/>';
+		input_area.empty();
+		input_area.append(html);
+		$('#' + id).focus();
+	},
+
+	setDemoMode : function(demoMode) {
+		this.demo = demoMode;
+	}
+};
+})(jQuery);

example/example/templates/authopenid/associate.html

+{% extends "base.html" %}
+{% load i18n %}
+
+{% block content %}
+{% if msg %}
+	<div class="errors"><p>{{ msg }}</p></div>
+{% endif %}
+
+{% if form.errors %}
+    <div class="errors"><p>Openid url : {{ form.openid_url.errors|join:', ' }}</p></div>
+{% endif %}
+
+<div class="login">
+
+<form name="openid_form" id="openid_form" action="{% url user_associate %}" method="post">
+    {% csrf_token %}
+    <input type="hidden" name="action" value="verify" />
+    <input type="hidden" name="next" value="{{ next }}" />
+	<fieldset>
+		<legend>{% trans "Add a new OpenID URL" %}</legend>
+		<div id="openid_choice">
+    		<p>Please click your account provider:</p>
+    		<div id="openid_btns"></div>
+    	</div>
+    	<div id="openid_input_area">
+            <label for="id_openid_url">{% trans "OpenId URL :" %}</label><br />{{ form.openid_url }}
+            <input name="openid_submit" type="submit" value="{% trans "Add OpenID" %}">
+		</div>
+	</fieldset>
+</form>	
+</div>	
+{% endblock %}
+
+{% block extra_scripts %}
+<script type="text/javascript" src="{{ STATIC_URL }}/js/openid-jquery.js"></script>
+<script type="text/javascript">
+$(document).ready(function() {
+    openid.init('id_openid_url');
+});
+</script>
+{% endblock %}

example/example/templates/authopenid/associate_email.txt

+Thank you to join {{ site }}.

example/example/templates/authopenid/associate_email_subject.txt

+Welcome to {{ site }}

example/example/templates/authopenid/complete.html

+{% extends "base.html" %}
+{% load i18n %}
+
+
+
+{% block head %}{% endblock %}
+
+
+{% block content %}
+
+	<div id="completetxt">
+	<h1>{% trans "Your OpenID is verified! " %}</h1>
+	{% blocktrans %}
+	<p>Your OpenID can now be associated with a new or existing membership. You can change the association later in your preferences.</p>
+	{% endblocktrans %}
+	<br /><br />
+	<h2>{% trans "Associate your OpenID" %}</h2>
+	{% blocktrans %}
+	<p>If you're joining <strong>Sitename</strong>, associate your OpenID with a new account. If you're already a member, associate with your existing account.</p>
+	{% endblocktrans %}
+	</div>
+
+		
+	
+	{% if form1.errors %}
+	<p class="errors">{% trans "Please correct errors below:" %}<br />
+		{% if form1.username.errors %} 
+			<span class="error">{{ form1.username.errors|join:", " }}</span>
+		{% endif %}
+		{% if form1.email.errors %} 
+			<span class="error">{{ form1.email.errors|join:", " }}</span>
+		{% endif %}
+	</p>
+	{% endif %}
+	{% if form2.errors %}
+	<p class="errors">{% trans "Please correct errors below:" %}<br />
+		{% if form2.username.errors %} 
+			<span class="error">{{ form2.username.errors|join:", " }}</span>
+		{% endif %}
+		{% if form2.password.errors %} 
+			<span class="error">{{ form2.password.errors|join:", " }}</span>
+		{% endif %}
+	</p>
+	{% endif %}
+
+	<div class="login">
+        <form name="fregister" action="{% url user_register %}" method="POST">
+            {% csrf_token %}
+            <input type="hidden" name="next" value="{{ next }}" />
+			<fieldset>
+				<legend>{% trans "A new account" %}</legend>
+				<div class="form-row"><label for="id_username">{% trans "Username" %}</label><br />{{ form1.username }}</div>
+				<div class="form-row"><label for="id_email">{% trans "Email" %}</label><br />{{ form1.email }}</div>
+				<div class="submit-row"><input type="submit" name="bnewaccount" value="{% trans "Create account" %}"></div>
+				<hr class="clear" />
+            	</fieldset>
+		</form>
+	</div>
+
+	
+
+	<div class="login">
+        <form name="fverify" action="{% url user_register %}" method="POST">
+	    {% csrf_token %}
+            <input type="hidden" name="next" value="{{ next }}" />
+			<fieldset>
+				<legend>{% trans "An existing account" %}</legend>
+				<div class="form-row"><label for="id_username">{% trans "Username" %}</label><br />{{ form2.username }}</div>
+				<div class="form-row"><label for="id_passwordl">{% trans "Password" %}</label><br />{{ form2.password }}</div>
+				<div class="submit-row"><input type="submit" name="bverify" value="{% trans "Verify" %}"></div>
+			</fieldset>
+		</form>
+	</div>
+{% endblock %}
+
+	
+

example/example/templates/authopenid/dissociate.html

+{% extends "base.html" %}
+{% load i18n %}
+
+{% block head %}
+
+
+{% endblock %}
+
+
+{% block content %}
+{% if msg %}
+	<p class="warning">{{ msg }}</p>
+{% endif %}
+
+<div class="login">
+
+<form name="fopenid" action="" method="post">
+    {% csrf_token %}
+    <input type="hidden" name="next" value="{{ next }}" />
+	{{ form.openid_url }}
+	<fieldset>
+		<legend>{% trans "Dissociate OpenID URL" %}</legend>
+        <p>Confirm to dissociate {{ openid_url }} from your account</p>
+        <div class="submit-row "><input name="bdissociate" type="submit" value="{% trans "Dissociate OpenID" %}"></div>
+		
+	</fieldset>
+</form>	
+</div>	
+{% endblock %}
+

example/example/templates/authopenid/failure.html

+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+  "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>OpenID failed</title>
+</head>
+<body>
+<h1>OpenID failed</h1>
+
+<p>{{ message|escape }}</p>
+
+</body>
+</html>

example/example/templates/authopenid/password_change_form.html

+{% extends "base.html" %}
+{% load i18n %}
+
+
+{% block content %}
+
+
+
+
+{% if set_password %}
+<h1>{% trans 'Set password' %}</h1>
+<p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p>
+
+<form action="" method="post">
+{% csrf_token %}
+{{ form.new_password1.errors }}
+<p class="aligned wide"><label for="id_new_password1">{% trans 'New password:' %}</label>{{ form.new_password1 }}</p>
+{{ form.new_password2.errors }}
+<p class="aligned wide"><label for="id_new_password2">{% trans 'Confirm password:' %}</label>{{ form.new_password2 }}</p>
+<p><input type="submit" value="{% trans 'Change my password' %}" /></p>
+</form>
+
+{% else %}
+
+<h1>{% trans 'Password change' %}</h1>
+<p>{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}</p>
+
+<form action="" method="post">
+{% csrf_token %}
+{{ form.old_password.errors }}
+<p class="aligned wide"><label for="id_old_password">{% trans 'Old password:' %}</label>{{ form.old_password }}</p>
+{{ form.new_password1.errors }}
+<p class="aligned wide"><label for="id_new_password1">{% trans 'New password:' %}</label>{{ form.new_password1 }}</p>
+{{ form.new_password2.errors }}
+<p class="aligned wide"><label for="id_new_password2">{% trans 'Confirm password:' %}</label>{{ form.new_password2 }}</p>
+
+<p><input type="submit" value="{% trans 'Change my password' %}" /></p>
+</form>
+
+
+
+{% endif %}
+{% endblock %} 

example/example/templates/authopenid/signin.html

+{% extends "base.html" %}
+{% load i18n %}
+
+{% block content %}
+{% if msg %}
+<br />
+	<p class="warning">{{ msg }}</p>
+{% endif %}
+{% if form2.errors %}
+<div class="errors"><p>{% trans "Please correct errors below:" %}<br />
+
+</p></div>
+<br>
+{% endif %}
+
+{% if form1.errors %}
+<div class="errors">
+    <p><span class="error">{{ form1.openid_url.errors|join:", " }}</span></p>
+</div>
+<br>
+{% endif %}
+<h2>Make a choice:</h2>
+<p> <a href="{% url registration_register %}">Register</a> | <a href="{% url user_signin %}">Log-In</a></p>
+<div class="login">
+
+    <form id="auth_form" name="auth_form" action="{% url user_signin %}" method="post">
+    {% csrf_token %}
+    <input type="hidden" name="next" value="{{ next }}" />
+	<fieldset>
+		<legend>{% trans "Sign In Using Your Account ID" %}</legend>
+		<div class="form-row"><label for="id_username">{% trans "Username:" %}</label><br />{{ form2.username }}</div>
+		{% if form2.username.errors %} 
+			<span class="error">{{ form2.username.errors|join:", " }}</span>
+		{% endif %}
+		<div class="form-row"><label for="id_password">{% trans "Password" %}</label><br />{{ form2.password }}</div>
+		{% if form2.password.errors %} 
+			<span class="error">{{ form2.password.errors|join:", " }}</span>
+		{% endif %}
+        <div class="submit-row"><input type="submit" name="blogin" value="{% trans "Sign in" %}"> </div>
+	</fieldset>
+</form>
+
+<form id="openid_form" name="openid_form" action="{% url user_signin %}" method="post">
+    {% csrf_token %}
+    <input type="hidden" name="action" value="verify" />
+    <input type="hidden" name="next" value="{{ next }}" />
+	<fieldset>
+		<legend>{% trans "Sign In Using Your OpenID URL" %}</legend>
+		<div id="openid_choice">
+    		<p>Please click your account provider:</p>
+    		<div id="openid_btns"></div>
+    	</div>
+    	    <div id="openid_input_area">
+                <label for="id_openid_url">{% trans "OpenId URL :" %}</label>{{ form1.openid_url }}
+                <input name="openid_submit" type="submit" value="{% trans "Sign in with OpenID" %}">
+            </div>
+		
+	</fieldset>
+</form>	
+</div>	
+{% endblock %}
+
+{% block extra_scripts %}
+<script type="text/javascript" src="{{ STATIC_URL }}js/openid-jquery.js"></script>
+<script type="text/javascript" src="{{ STATIC_URL }}js/openid-en.js"></script>
+<script type="text/javascript">
+$(document).ready(function() {
+    openid.init('openid_url');
+});
+</script>
+<!-- /Simple OpenID Selector -->
+    
+{% endblock %}
+

example/example/templates/base.html

+<!DOCTYPE html>
+<html lang="en">
+    <head>
+        <meta charset="utf-8"/>
+        <title>django-authopenid Example App</title>
+        <!--[if IE]>
+
+        <script>
+            // allow IE to recognize HTMl5 elements
+            document.createElement('section');
+            document.createElement('article');
+            document.createElement('aside');
+            document.createElement('footer');
+            document.createElement('header');
+            document.createElement('nav');
+            document.createElement('time');
+
+        </script>
+        <![endif]-->
+        {% if request.is_secure %}
+        <meta http-equiv="X-XRDS-Location" content="https://{{ request.get_host }}{% url oid_xrdf %}" />
+        {% else %}
+        <meta http-equiv="X-XRDS-Location" content="http://{{ request.get_host }}{% url oid_xrdf %}" />  
+        {% endif %}
+
+        <link rel="stylesheet" href="{{ STATIC_URL }}css/base.css" />
+        <link rel="stylesheet" href="{{ STATIC_URL }}css/openid.css" />
+        {% block head %}
+        {% endblock %}
+    </head>
+    <body>
+        <header id="top">
+            <h1>django-authopenid Example App</h1>
+        </header>
+        
+        {% block content %}{% endblock %}
+        
+        <script type="text/javascript" src="{{ STATIC_URL }}admin/js/jquery.min.js"></script>
+
+    	{% block extra_scripts %}{% endblock %}
+    	
+    	<footer id="bottom">
+        <p>This is an example of how to use <strong>django-authopenid</strong> with modified  
+        <a href="http://code.google.com/p/openid-selector/">Javascript OpenID-Selector</a> in a <a href="http://djangoproject.com">django</a> application. <a href="http://bitbucket.org/benoitc/django-authopenid/">More...</a>
+        </footer>
+    </body>
+</html>

example/example/templates/home.html

+{% extends "base.html" %}
+{% load i18n %}
+
+{% block content %}
+<p>Welcome {{ user }}</p>
+
+
+{% if request.GET.msg %}
+	<p class="warning">{{ request.GET.msg }}</p>
+{% endif %}
+
+{% if user.is_authenticated%}
+
+{% if has_openids %}
+<h2>Associated openids</h2>
+<ul>
+	{% for oid_url in associated_openids %}
+		<li>{{ oid_url }} (<a href="{% url user_dissociate %}?openid_url={{ oid_url }}">dissociate</a>)</li>
+	{% endfor %}
+</ul>
+
+{% endif %}
+
+
+
+<h2>Actions:</h2>
+<ul>
+	<li><a href="{% url user_associate %}">Associate a new openid</a></li>
+	<li><a href="{% url auth_password_change %}">Change password</a></li>
+  	<li><a href="{% url user_signout %}?next=/">signout</a></li>
+</ul>
+{% else %}
+<h2>Make a choice:</h2>
+<p> <a href="{% url registration_register %}">Register</a> | <a href="{% url user_signin %}">Log-In</a></p>
+<div class="login">
+
+    <form id="auth_form" name="auth_form" action="{% url user_signin %}" method="post">
+    {% csrf_token %}
+    <input type="hidden" name="next" value="{{ next }}" />
+	<fieldset>
+	    
+	    
+		<legend>{% trans "Sign In Using Your Account ID" %}</legend>
+		<div class="form-row"><label for="id_username">{% trans "Username:" %}</label><br />{{ form2.username }}</div>
+		<div class="form-row"><label for="id_password">{% trans "Password" %}</label><br />{{ form2.password }}</div>
+		
+        <div class="submit-row"><input type="submit" name="blogin" value="{% trans "Sign in" %}"> </div>
+	</fieldset>	
+</form>
+
+<form id="openid_form" name="openid_form" action="{% url user_signin %}" method="post">
+    {% csrf_token %}
+    <input type="hidden" name="action" value="verify" />
+    <input type="hidden" name="next" value="{{ next }}" />
+	<fieldset>
+		<legend>{% trans "Sign In Using Your OpenID URL" %}</legend>
+		<div id="openid_choice">
+    		<p>Please click your account provider:</p>
+    		<div id="openid_btns"></div>
+    	</div>
+    	    <div id="openid_input_area">
+                <label for="id_openid_ul">{% trans "OpenId URL :" %}</label>{{ form1.openid_url }}
+                <input name="openid_submit" type="submit" value="{% trans "Sign in with OpenID" %}">
+            </div>
+		
+	</fieldset>
+</form>
+</div>
+
+{% endif %}
+
+{% endblock %}
+
+{% block extra_scripts %}
+{% if not has_openids %}
+<script type="text/javascript" src="{{ STATIC_URL }}js/openid-jquery.js"></script>
+<script type="text/javascript" src="{{ STATIC_URL }}js/openid-en.js"></script>
+<script type="text/javascript">
+$(document).ready(function() {
+    openid.init('openid_url');
+});
+</script>
+<!-- /Simple OpenID Selector -->
+{% endif %}
+{% endblock %}

example/example/templates/registration/activate.html

+{% extends "base.html" %}
+{% load i18n %}
+
+{% block head %}
+
+
+{% endblock %}
+
+
+{% block content %}
+
+{% blocktrans %}
+<h1>Activation</h1>
+<p>Your account is now activated. Go <a href="/">here</a> to continue.</p>
+
+{% endblocktrans %}
+
+{% endblock %}

example/example/templates/registration/activation_complete.html

+{% extends "base.html" %}
+{% load i18n %}
+
+{% block head %}
+
+
+{% endblock %}
+
+
+{% block content %}
+
+{% blocktrans %}
+<h1>Activation</h1>
+<p>Your account is now activated.</p>
+{% endblocktrans %}
+
+{% endblock %}

example/example/templates/registration/activation_email.txt

+Hi,
+
+Thank you for your registration. To activate your account click on the link below :
+
+<a href="http://openid-example.e-engura.org{% url registration_activate activation_key %}">{% url registration_activate activation_key %}</a>.
+

example/example/templates/registration/activation_email_subject.txt

+{{ site }}. Confirm your registration

example/example/templates/registration/registration_complete.html

+{% extends "base.html" %}
+{% load i18n %}
+
+{% block head %}
+
+
+{% endblock %}
+
+
+{% block content %}
+
+{% blocktrans %}
+<h1>Thank you</h1>
+<p>An email has been sent to you. You need to click link in it to activate your account.</p>
+{% endblocktrans %}
+
+{% endblock %}

example/example/templates/registration/registration_form.html

+{% extends "base.html" %}
+{% load i18n %}
+
+{% block head %}
+
+
+{% endblock %}
+
+
+{% block content %}
+{% if form.errors %}
+    <div class="errors">
+        <p>Error while submitting form</p>
+        
+    </div>
+    <br>
+{% endif %}
+
+<h2>Make a choice:</h2>
+<p> <a href="{% url registration_register %}">Register</a> | <a href="{% url user_signin %}">Sign-In</a></p>
+
+<form action="" method="post">
+    {% csrf_token %}
+    <fieldset>
+	    <legend>{% trans "Create a new account" %}</legend>
+	    <table>
+		    {{ form.as_table }}
+	    </table>
+	    <p><input type="submit" name="bsignup'" value="{% trans "Sign up" %}"> </p>
+	 </fieldset>
+</form>
+{% endblock %}

example/example/urls.py

+from django.conf.urls import patterns, include, url
+from django.contrib import admin
+
+admin.autodiscover()
+
+urlpatterns = patterns('',
+    url(r'^$', 'example.views.home', name='home'),
+    url(r'^account/', include('django_authopenid.urls')),
+
+    url(r'^admin/', include(admin.site.urls)),
+)

example/example/views.py

+# -*- coding: utf-8 -*-
+from django.shortcuts import render
+from django.contrib.auth.forms import AuthenticationForm
+from django_authopenid.forms import OpenidSigninForm
+
+
+def home(request):
+    form1 = OpenidSigninForm()
+    form2 = AuthenticationForm()
+
+    return render(request, "home.html", {
+        'form1': form1,
+        'form2': form2
+    })

example/example/wsgi.py

+"""
+WSGI config for example project.
+
+This module contains the WSGI application used by Django's development server
+and any production WSGI deployments. It should expose a module-level variable
+named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
+this application via the ``WSGI_APPLICATION`` setting.
+
+Usually you will have the standard Django WSGI application here, but it also
+might make sense to replace the whole Django WSGI application with a custom one
+that later delegates to the Django one. For example, you could introduce WSGI
+middleware here, or combine a Django application with an application of another
+framework.
+
+"""
+import os
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings")
+
+# This application object is used by any WSGI server configured to use this
+# file. This includes Django's development server, if the WSGI_APPLICATION
+# setting points here.
+from django.core.wsgi import get_wsgi_application