summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-07-30 14:28:05 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-07-30 14:28:05 -0400
commite7db1769bafc84cbad3ca50640dbb17678b35101 (patch)
treed53ca29de45ca1c02921b06b863303a96f095c3c
parent4ca05718d7aa3e61027e10ff9e7a41aca69f6f0a (diff)
parentf0cf7e63ad0f2d635dd26e63b85f35abe8d32957 (diff)
downloadaskbot-e7db1769bafc84cbad3ca50640dbb17678b35101.tar.gz
askbot-e7db1769bafc84cbad3ca50640dbb17678b35101.tar.bz2
askbot-e7db1769bafc84cbad3ca50640dbb17678b35101.zip
Merge branch 'rtnpro'
-rw-r--r--askbot/conf/external_keys.py25
-rw-r--r--askbot/conf/login_providers.py3
-rw-r--r--askbot/deps/django_authopenid/util.py23
-rw-r--r--askbot/skins/default/media/jquery-openid/images/identica.pngbin0 -> 4044 bytes
4 files changed, 50 insertions, 1 deletions
diff --git a/askbot/conf/external_keys.py b/askbot/conf/external_keys.py
index d96429b9..b0f7c1dd 100644
--- a/askbot/conf/external_keys.py
+++ b/askbot/conf/external_keys.py
@@ -139,6 +139,31 @@ settings.register(
)
settings.register(
+ livesettings.StringValue(
+ EXTERNAL_KEYS,
+ 'IDENTICA_KEY',
+ description=_('Ident.ca consumer key'),
+ help_text=_(
+ 'Please register your forum at <a href="http://identi.ca/settings/oauthapps">'
+ 'Identi.ca applications site</a>'
+ ),
+
+ )
+)
+
+settings.register(
+ livesettings.StringValue(
+ EXTERNAL_KEYS,
+ 'IDENTICA_SECRET',
+ description=_('Ident.ca consumer secret'),
+ )
+)
+
+settings.register(
+ livesettings.StringValue(
+ EXTERNAL_KEYS,
+
+settings.register(
livesettings.BooleanValue(
EXTERNAL_KEYS,
'USE_LDAP_FOR_PASSWORD_LOGIN',
diff --git a/askbot/conf/login_providers.py b/askbot/conf/login_providers.py
index 68ab6a52..56423ca4 100644
--- a/askbot/conf/login_providers.py
+++ b/askbot/conf/login_providers.py
@@ -47,9 +47,10 @@ providers = (
'Vidoop',
'Verisign',
'Yahoo',
+ 'identi.ca',
)
-need_extra_setup = ('Twitter', 'Facebook', 'LinkedIn')
+need_extra_setup = ('Twitter', 'Facebook', 'LinkedIn', 'identi.ca',)
for provider in providers:
kwargs = {
diff --git a/askbot/deps/django_authopenid/util.py b/askbot/deps/django_authopenid/util.py
index 9dfbc596..a01495ca 100644
--- a/askbot/deps/django_authopenid/util.py
+++ b/askbot/deps/django_authopenid/util.py
@@ -11,6 +11,7 @@ import oauth2 as oauth
from django.db.models.query import Q
from django.conf import settings
+from django.utils import simplejson
from django.utils.datastructures import SortedDict
from django.utils.translation import ugettext as _
from django.core.exceptions import ImproperlyConfigured
@@ -404,6 +405,25 @@ def get_enabled_major_login_providers():
'icon_media_path': '/jquery-openid/images/twitter.gif',
'get_user_id_function': lambda data: data['user_id'],
}
+ def get_identica_user_id(data):
+ consumer = oauth.Consumer(data['consumer_key'], data['consumer_secret'])
+ token = oauth.Token(data['oauth_token'], data['oauth_token_secret'])
+ client = oauth.Client(consumer, token=token)
+ url = 'https://identi.ca/api/account/verify_credentials.json'
+ json = simplejson.loads(content)
+ return json['id']
+ if askbot_settings.IDENTICA_KEY and askbot_settings.IDENTICA_SECRET:
+ data['identi.ca'] = {
+ 'name': 'identi.ca',
+ 'display_name': 'identi.ca',
+ 'type': 'oauth',
+ 'request_token_url': 'https://identi.ca/api/oauth/request_token',
+ 'access_token_url': 'https://identi.ca/api/oauth/access_token',
+ 'authorize_url': 'https://identi.ca/api/oauth/authorize',
+ 'authenticate_url': 'https://identi.ca/api/oauth/authorize',
+ 'icon_media_path': '/jquery-openid/images/identica.png',
+ 'get_user_id_function': get_identica_user_id,
+ }
def get_linked_in_user_id(data):
consumer = oauth.Consumer(data['consumer_key'], data['consumer_secret'])
token = oauth.Token(data['oauth_token'], data['oauth_token_secret'])
@@ -634,6 +654,9 @@ def get_oauth_parameters(provider_name):
elif provider_name == 'linkedin':
consumer_key = askbot_settings.LINKEDIN_KEY
consumer_secret = askbot_settings.LINKEDIN_SECRET
+ elif provider_name == 'identi.ca':
+ consumer_key = askbot_settings.IDENTICA_KEY
+ consumer_secret = askbot_settings.IDENTICA_SECRET
else:
raise ValueError('sorry, only linkedin and twitter oauth for now')
diff --git a/askbot/skins/default/media/jquery-openid/images/identica.png b/askbot/skins/default/media/jquery-openid/images/identica.png
new file mode 100644
index 00000000..b32c6f95
--- /dev/null
+++ b/askbot/skins/default/media/jquery-openid/images/identica.png
Binary files differ