diff options
author | Ratnadeep Debnath <rtnpro@gmail.com> | 2011-07-30 18:58:34 +0530 |
---|---|---|
committer | Ratnadeep Debnath <rtnpro@gmail.com> | 2011-07-30 18:58:34 +0530 |
commit | f0cf7e63ad0f2d635dd26e63b85f35abe8d32957 (patch) | |
tree | 3da21436a7b6d1a4a1b644c1bf89f2cbc3a0a0bc | |
parent | 93cbe7d3e8d54bb1cced4b1a293a19c1baa34f11 (diff) | |
download | askbot-f0cf7e63ad0f2d635dd26e63b85f35abe8d32957.tar.gz askbot-f0cf7e63ad0f2d635dd26e63b85f35abe8d32957.tar.bz2 askbot-f0cf7e63ad0f2d635dd26e63b85f35abe8d32957.zip |
Added Identi.ca oauth signin method in askbot
-rw-r--r-- | askbot/conf/external_keys.py | 25 | ||||
-rw-r--r-- | askbot/conf/login_providers.py | 3 | ||||
-rw-r--r-- | askbot/deps/django_authopenid/util.py | 23 | ||||
-rw-r--r-- | askbot/skins/default/media/jquery-openid/images/identica.png | bin | 0 -> 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 44328a25..61f29d1d 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 Binary files differnew file mode 100644 index 00000000..b32c6f95 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/identica.png |