Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making is_lazy_user return false if connected with django-allauth #16

Open
nkeilar opened this issue Feb 8, 2012 · 4 comments
Open

Comments

@nkeilar
Copy link

nkeilar commented Feb 8, 2012

I'm trying to integrate django-lazysignup, and django-allauth. I've modified the convert page to linking to a social account. Once this is done I want is_lazy_user to return False as login should happen via allauth now. I've had a look at the template tag code and it checks user.backend, which I'm setting to '' in the allauth login routine. Specifically I modified complete_social_login() in allauth/socialaccount/helpers.py to include the following at Line 107

# New social account
        account.user = request.user
        account.sync(data)
        messages.add_message \
        (request, messages.INFO,
         _('The social account has been connected to your existing account'))
        try:
            #TODO check if the values exist first
            #account.user.username = generate_unique_username(data.get('username', email or 'user'))
            #account.user.username = "testmanualsetting"
            account.user.last_name = data.get('last_name', '')[0:User._meta.get_field('last_name').max_length]
            account.user.first_name = data.get('first_name', '')[0:User._meta.get_field('first_name').max_length]
            account.user.lazyuser_set.all().delete()
            account.user.backend = ''
            account.user.save()
        except:
            pass

Also I noted that it falls back on database entries, so I've removed those too. After this is_lazy_user is still returning True. Is this something to do with me updating user.backend on the wrong instance?

I know this isn't really an 'Issue' with lazysignup but wasn't sure where to post for advice.

Thanks in advance,

Nathan

@danfairs
Copy link
Owner

danfairs commented Feb 8, 2012

Hi Nathan,

I'm not familiar with allauth. However, you're most likely right - there's probably another instance of the user hanging around, as Django doesn't have an identity mapper. It's difficult to say without seeing the code, though. Try comparing id(account.user) from the code about with id(request.user) from whatever code you're calling is_lazy_user with.

If you can put together some code that demonstrates the problem (perhaps in a github repo?) that I can just check out and run, then I'll try to see if I can see what's going on.

@aladagemre
Copy link

Any news on this?

@danfairs
Copy link
Owner

No, I don't think any work has been done on this integration - unless it's in a repo I don't know about!

@nkeilar
Copy link
Author

nkeilar commented Oct 25, 2013

No, I've not had any further time to dedicate to this. Its a nice to have feature, but has not been required to date. I'm confident there is a solution that isn't too complex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants