AttributeError: 'AnonymousUser' object has no attribute 'backend'

VERIFIED INVALID

Status

Participation Infrastructure
Phonebook
VERIFIED INVALID
7 years ago
6 years ago

People

(Reporter: retornam, Assigned: ozten)

Tracking

Details

(URL)

(Reporter)

Description

7 years ago
Traceback (most recent call last):

  File "/data/www/mozillians.allizom.org/mozillians/vendor/src/django/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/data/www/mozillians.allizom.org/mozillians/vendor/src/django-session-csrf/session_csrf/__init__.py", line 107, in wrapper
    response = f(request, *args, **kw)

  File "/data/www/mozillians.allizom.org/mozillians/apps/users/views.py", line 41, in register
    uniq_id = _save_new_user(request, form)

  File "/data/www/mozillians.allizom.org/mozillians/apps/users/views.py", line 136, in _save_new_user
    auth.login(request, user)

  File "/data/www/mozillians.allizom.org/mozillians/vendor/src/django/django/contrib/auth/__init__.py", line 73, in login
    request.session[BACKEND_SESSION_KEY] = user.backend

  File "/data/www/mozillians.allizom.org/mozillians/vendor/src/django/django/utils/functional.py", line 173, in inner
    return func(self._wrapped, *args)

AttributeError: 'AnonymousUser' object has no attribute 'backend'
Raymond, how are you hitting this bug?
(Reporter)

Comment 2

7 years ago
(In reply to Aakash Desai [:aakashd] from comment #1)
> Raymond, how are you hitting this bug?

I wasn't the one who produced this bug, I filed this bug from the traceback emails
(Assignee)

Comment 3

7 years ago
Aside: Without steps to reproduce, these bugs aren't going to get fixed very quickly.

Registering a new user on stage causes this stack trace. (Not on dev, because of a different issue).

Steps to Reproduce:
1) Clear cookies
2) Click Join Us
3) Fill in form and submit

Expected:
Edit profile

Actual:
500, stacktrace in Comment:0.
(Assignee)

Comment 4

7 years ago
This reproduces in -dev now that bug#688199 is stubbed out.
(Assignee)

Comment 5

7 years ago
Forgot the obvious - Does not repro on my local machine :(

Asked @jason to clear pyc files from -dev and stage.
Assignee: nobody → ozten.bugs
(Assignee)

Comment 6

7 years ago
If I hardcode the wrong password[1] into authentication, this is reproducible.

This is a password issue like Bug#688121. Could this be an issue with backend datastore?

[1] https://github.com/mozilla/mozillians/blob/master/apps/users/views.py#L135
(Assignee)

Comment 8

7 years ago
This is on -dev now. Results in expected

Exception: Authentication for new user [sdflkjsdklfj@lksjdflkjsdc.com] with password len 8 failed

So... why isn't django_auth_ldap.backend.LDAPBackend able to authenticate the user?

Could be a replication issue...
Could be an ACL issue...
(Assignee)

Comment 9

7 years ago
sdflkjsdklfj@lksjdflkjsdc.com exists and I can login with the same password.

login and register ultimately use the same codepath, so that rules out a ACL issue.
(Assignee)

Updated

7 years ago
Duplicate of this bug: 688280
(Assignee)

Comment 11

7 years ago
Another traceback that can be caused by these STR

/en-US/register/edit/5c8e38e911
Traceback (most recent call last):

  File "/data/www/mozillians.allizom.org/mozillians/vendor/src/django/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/data/www/mozillians.allizom.org/mozillians/apps/phonebook/views.py", line 106, in edit_new_profile
    return _edit_profile(request, unique_id, True)

  File "/data/www/mozillians.allizom.org/mozillians/apps/phonebook/views.py", line 111, in _edit_profile
    person = ldap.get_by_unique_id(unique_id)

  File "/data/www/mozillians.allizom.org/mozillians/apps/larper/__init__.py", line 180, in get_by_unique_id
    raise NO_SUCH_PERSON(msg % unique_id)

NO_SUCH_PERSON: Unable to locale 5c8e38e911 in the LDAP directory

So here we failed to create the user, we silently fail auth, then are redirected to the reg edit profile page, which fails since the user doesn't exist. Filed Bug#688476 to deploy latest to stage... which shouldn't allow this silent auth failure.
(Assignee)

Comment 12

7 years ago
This no longer reproduces with stage config fixed in Bug#688204.
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → INVALID
Verified registering user works.
Status: RESOLVED → VERIFIED

Updated

6 years ago
Component: mozillians.org → Phonebook
Product: Websites → Community Tools
QA Contact: mozillians-org → phonebook
Version: unspecified → other
You need to log in before you can comment on or make changes to this bug.