diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2011-04-11 01:56:52 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2011-04-11 01:56:52 -0400 |
commit | 20e1a7a2fe508d42353e0b0481d6de69119e0b2c (patch) | |
tree | 3bf36b11b650d2fa9598ac53521542124f83a3a2 | |
parent | bdc72b60897de2b4a524ca9468b4091515048f97 (diff) | |
download | askbot-20e1a7a2fe508d42353e0b0481d6de69119e0b2c.tar.gz askbot-20e1a7a2fe508d42353e0b0481d6de69119e0b2c.tar.bz2 askbot-20e1a7a2fe508d42353e0b0481d6de69119e0b2c.zip |
temporarily disabled facebook login and commented the parameters for OAuth providers
-rw-r--r-- | askbot/deps/django_authopenid/util.py | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/askbot/deps/django_authopenid/util.py b/askbot/deps/django_authopenid/util.py index 355854bb..a913400f 100644 --- a/askbot/deps/django_authopenid/util.py +++ b/askbot/deps/django_authopenid/util.py @@ -168,23 +168,44 @@ def use_password_login(): return True def get_major_login_providers(): - """returns a tuple with data about login providers + """returns a dictionary with data about login providers whose icons are to be shown in large format - items of tuple are dictionaries with keys: + items of the dictionary are dictionaries with keys: * name * display_name * icon_media_path (relative to /media directory) * type (oauth|openid-direct|openid-generic|openid-username|password) - Fields dependent on type: + Fields dependent on type of the login provider type + --------------------------------------------------- + + Password (type = password) - login provider using login name and password: + + * extra_token_name - a phrase describing what the login name and the + password are from + * create_password_prompt - a phrase prompting to create an account + * change_password_prompt - a phrase prompting to change password + + OpenID (type = openid) - Provider of login using the OpenID protocol * openid_endpoint (required for type=openid|openid-username) for type openid-username - the string must have %(username)s format variable, plain string url otherwise * extra_token_name - required for type=openid-username describes name of required extra token - e.g. "XYZ user name" + + OAuth2 (type = oauth) + + * request_token_url - url to initiate OAuth2 protocol with the resource + * access_token_url - url to access users data on the resource via OAuth2 + * authorize_url - url at which user can authorize the app to access a resource + * authenticate_url - url to authenticate user (lower privilege than authorize) + * get_user_id_function - a function that returns user id from data dictionary + containing: response to the access token url & consumer_key + and consumer secret. The purpose of this function is to hide the differences + between the ways user id is accessed from the different OAuth providers """ data = SortedDict() @@ -201,13 +222,13 @@ def get_major_login_providers(): 'icon_media_path': askbot_settings.LOCAL_LOGIN_ICON, } - if askbot_settings.FACEBOOK_KEY and askbot_settings.FACEBOOK_SECRET: - data['facebook'] = { - 'name': 'facebook', - 'display_name': 'Facebook', - 'type': 'facebook', - 'icon_media_path': '/jquery-openid/images/facebook.gif', - } + #if askbot_settings.FACEBOOK_KEY and askbot_settings.FACEBOOK_SECRET: + # data['facebook'] = { + # 'name': 'facebook', + # 'display_name': 'Facebook', + # 'type': 'facebook', + # 'icon_media_path': '/jquery-openid/images/facebook.gif', + # } if askbot_settings.TWITTER_KEY and askbot_settings.TWITTER_SECRET: data['twitter'] = { 'name': 'twitter', @@ -468,6 +489,8 @@ class OAuthConnection(object): ) def start(self, callback_url = None): + """starts the OAuth protocol communication and + saves request token as :attr:`request_token`""" if callback_url is None: callback_url = self.callback_url @@ -504,6 +527,9 @@ class OAuthConnection(object): return self.request_token def get_user_id(self, oauth_token = None, oauth_verifier = None): + """Returns user ID within the OAuth provider system, + based on ``oauth_token`` and ``oauth_verifier`` + """ token = oauth.Token( oauth_token['oauth_token'], @@ -520,8 +546,7 @@ class OAuthConnection(object): def get_auth_url(self, login_only = False): """returns OAuth redirect url. - callback_url is the redirect that will be used by the - provider server, if login_only is True, authentication + if ``login_only`` is True, authentication endpoint will be used, if available, otherwise authorization url (potentially granting full access to the server) will be used. |