summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2013-04-20 20:44:50 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2013-04-20 20:44:50 -0400
commitea03d66c21d7158115cf4d05490ef7c78de7cf70 (patch)
tree7076952cca68cf27b4ffd33492890b1b29ea674d
parentc1c4ed1535ca1b8fe603c47eb1e94ec6fe0a6baa (diff)
downloadaskbot-ea03d66c21d7158115cf4d05490ef7c78de7cf70.tar.gz
askbot-ea03d66c21d7158115cf4d05490ef7c78de7cf70.tar.bz2
askbot-ea03d66c21d7158115cf4d05490ef7c78de7cf70.zip
fixed a bug in the login page where it was impossible to remove password login fields
-rw-r--r--askbot/conf/ldap.py10
-rw-r--r--askbot/conf/login_providers.py15
-rw-r--r--askbot/deps/django_authopenid/util.py19
3 files changed, 20 insertions, 24 deletions
diff --git a/askbot/conf/ldap.py b/askbot/conf/ldap.py
index 34b6ec87..7d384516 100644
--- a/askbot/conf/ldap.py
+++ b/askbot/conf/ldap.py
@@ -10,20 +10,12 @@ LDAP_SETTINGS = livesettings.ConfigurationGroup(
super_group = EXTERNAL_SERVICES
)
-def enable_ldap_callback(current_value, new_value):
- """enables local login form when ldap is on"""
- if new_value == True:
- settings.update('SIGNIN_LOCAL_ENABLED', True)
-
- return new_value
-
settings.register(
livesettings.BooleanValue(
LDAP_SETTINGS,
'USE_LDAP_FOR_PASSWORD_LOGIN',
description=_('Use LDAP authentication for the password login'),
- defaut=False,
- update_callback=enable_ldap_callback
+ defaut=False
)
)
diff --git a/askbot/conf/login_providers.py b/askbot/conf/login_providers.py
index 2ee59e2a..36f71502 100644
--- a/askbot/conf/login_providers.py
+++ b/askbot/conf/login_providers.py
@@ -84,18 +84,21 @@ providers = (
'LaunchPad'
)
-DISABLED_BY_DEFAULT = (
- 'LaunchPad'
-)
+DISABLED_BY_DEFAULT = ('LaunchPad',)
-need_extra_setup = ('Twitter', 'Facebook', 'LinkedIn', 'identi.ca',)
+NEED_EXTRA_SETUP = ('Twitter', 'Facebook', 'LinkedIn', 'identi.ca',)
for provider in providers:
+ if provider == 'local':
+ provider_string = unicode(_('local password'))
+ else:
+ provider_string = provider
+
kwargs = {
- 'description': _('Activate %(provider)s login') % {'provider': provider},
+ 'description': _('Activate %(provider)s login') % {'provider': provider_string},
'default': not (provider in DISABLED_BY_DEFAULT)
}
- if provider in need_extra_setup:
+ if provider in NEED_EXTRA_SETUP:
kwargs['help_text'] = _(
'Note: to really enable %(provider)s login '
'some additional parameters will need to be set '
diff --git a/askbot/deps/django_authopenid/util.py b/askbot/deps/django_authopenid/util.py
index 024dbf09..8c9e78da 100644
--- a/askbot/deps/django_authopenid/util.py
+++ b/askbot/deps/django_authopenid/util.py
@@ -160,19 +160,20 @@ def get_provider_name(openid_url):
def use_password_login():
"""password login is activated
- either if USE_RECAPTCHA is false
- of if recaptcha keys are set correctly
+ if any of the login methods requiring user name
+ and password are activated
+
+ TODO: these should be mutually exclusive and
+ it should be possible to register another login
+ method using password and user name via configuration
"""
if askbot_settings.SIGNIN_WORDPRESS_SITE_ENABLED:
return True
- if askbot_settings.USE_RECAPTCHA:
- if askbot_settings.RECAPTCHA_KEY and askbot_settings.RECAPTCHA_SECRET:
- return True
- else:
- logging.critical('if USE_RECAPTCHA == True, set recaptcha keys!!!')
- return False
- else:
+ if askbot_settings.SIGNIN_LOCAL_ENABLED:
+ return True
+ if askbot_settings.USE_LDAP_FOR_PASSWORD_LOGIN:
return True
+ return False
def filter_enabled_providers(data):
"""deletes data about disabled providers from