summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-07-17 21:13:14 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-07-17 21:13:14 -0400
commitfa623436c009a467980454b2004ad9feb7d7276c (patch)
treee778971c50bbe1d6e981be8811366a50c1669979
parente59bf4a4b7acd6d1f06179777d9011fab7eb7147 (diff)
downloadaskbot-fa623436c009a467980454b2004ad9feb7d7276c.tar.gz
askbot-fa623436c009a467980454b2004ad9feb7d7276c.tar.bz2
askbot-fa623436c009a467980454b2004ad9feb7d7276c.zip
fixed bugs in ldap login
-rw-r--r--askbot/deps/django_authopenid/backends.py2
-rw-r--r--askbot/deps/django_authopenid/ldap_auth.py2
-rw-r--r--askbot/deps/django_authopenid/views.py5
-rw-r--r--askbot/skins/common/templates/authopenid/signin.html10
-rw-r--r--askbot/skins/default/media/style/style.less7
5 files changed, 15 insertions, 11 deletions
diff --git a/askbot/deps/django_authopenid/backends.py b/askbot/deps/django_authopenid/backends.py
index 7d6e126c..f41427b9 100644
--- a/askbot/deps/django_authopenid/backends.py
+++ b/askbot/deps/django_authopenid/backends.py
@@ -168,7 +168,7 @@ class AuthBackend(object):
elif method == 'ldap':
user_info = ldap_authenticate(username, password)
- if user_info is None:
+ if user_info['success'] == False:
# Maybe a user created internally (django admin user)
try:
user = User.objects.get(username__exact=username)
diff --git a/askbot/deps/django_authopenid/ldap_auth.py b/askbot/deps/django_authopenid/ldap_auth.py
index 79d05b44..e53125d5 100644
--- a/askbot/deps/django_authopenid/ldap_auth.py
+++ b/askbot/deps/django_authopenid/ldap_auth.py
@@ -55,6 +55,7 @@ def ldap_authenticate_default(username, password):
"""
import ldap
user_information = None
+ user_info = {}#the return value
try:
ldap_session = ldap.initialize(askbot_settings.LDAP_URL)
@@ -155,7 +156,6 @@ def ldap_authenticate_default(username, password):
user_info['success'] = False
except ldap.INVALID_CREDENTIALS, e:
- return None # Will fail login on return of None
user_info['success'] = False
except ldap.LDAPError, e:
LOG.error("LDAPError Exception")
diff --git a/askbot/deps/django_authopenid/views.py b/askbot/deps/django_authopenid/views.py
index bea8ffe9..c19f5a85 100644
--- a/askbot/deps/django_authopenid/views.py
+++ b/askbot/deps/django_authopenid/views.py
@@ -361,10 +361,7 @@ def signin(request):
auth_fail_func = load_module(auth_fail_func_path)
auth_fail_func(user_info, login_form)
else:
- errors = login_form._errors.setdefault('__all__', ErrorList())
- errors.append(
- _('Login failed, were your password/login name correct?')
- )
+ login_form.set_password_login_error()
#return HttpResponseRedirect(request.path)
else:
if password_action == 'login':
diff --git a/askbot/skins/common/templates/authopenid/signin.html b/askbot/skins/common/templates/authopenid/signin.html
index f9c0cfea..2cce65b1 100644
--- a/askbot/skins/common/templates/authopenid/signin.html
+++ b/askbot/skins/common/templates/authopenid/signin.html
@@ -97,10 +97,14 @@
{% if have_buttons %}
<p class="hint">{% trans %}(or select another login method above){% endtrans %}</p>
{% endif %}
- {% if login_form.password_login_failed %}
- <p class="error">{% trans %}Login failed, please try again{% endtrans %}</p>
- {% endif %}
<table class="login">
+ {% if login_form.password_login_failed %}
+ <tr>
+ <td colspan="2">
+ <p class="error">{% trans %}Login failed, please try again{% endtrans %}</p>
+ </td>
+ </tr>
+ {% endif %}
<tr>
<td><label for="id_username">{% trans %}Login or email{% endtrans %}</label></td>
<td>{{login_form.username}}</td>
diff --git a/askbot/skins/default/media/style/style.less b/askbot/skins/default/media/style/style.less
index 6480f3ff..3220c8e3 100644
--- a/askbot/skins/default/media/style/style.less
+++ b/askbot/skins/default/media/style/style.less
@@ -2807,10 +2807,13 @@ table.ab-subscr-form {
color: red;
}
-.error {
+.error,
+.openid-signin p.error {
color: darkred;
margin: 0;
- font-size: 10px;
+ font-size: 12px;
+ font-weight: bold;
+ text-align: center;
}
label.retag-error {