diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2012-07-10 13:55:32 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2012-07-10 13:55:44 -0400 |
commit | c44def9497c671672142f242fd3152bde5144411 (patch) | |
tree | ae9947323c83bd5f37c37402546d3288239cd5a5 /askbot/deps | |
parent | debd28158d0419d9ae3022cad765d614b64c543b (diff) | |
download | askbot-c44def9497c671672142f242fd3152bde5144411.tar.gz askbot-c44def9497c671672142f242fd3152bde5144411.tar.bz2 askbot-c44def9497c671672142f242fd3152bde5144411.zip |
made a tweak to LDAP login procedure
Diffstat (limited to 'askbot/deps')
-rw-r--r-- | askbot/deps/django_authopenid/views.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/askbot/deps/django_authopenid/views.py b/askbot/deps/django_authopenid/views.py index e63988fb..812fed07 100644 --- a/askbot/deps/django_authopenid/views.py +++ b/askbot/deps/django_authopenid/views.py @@ -313,6 +313,10 @@ def signin(request): username = login_form.cleaned_data['username'] password = login_form.cleaned_data['password'] # will be None if authentication fails + + #todo: since django 1.2 there is .exists() + user_is_old = (User.objects.filter(username = username).count() > 0) + user = authenticate( username=username, password=password, @@ -320,7 +324,16 @@ def signin(request): ) if user is not None: login(request, user) - return HttpResponseRedirect(next_url) + if user_is_old: + return HttpResponseRedirect(next_url) + else: + return finalize_generic_signin( + request = request, + user = user, + user_identifier = username,#is this right? + login_provider_name = provider_name, + redirect_url = next_url + ) else: request.user.message_set.create(_('Incorrect user name or password')) return HttpResponseRedirect(request.path) |