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

Sign up doesn't work out of the box #294

Open
diegovargasf opened this issue Sep 14, 2018 · 3 comments
Open

Sign up doesn't work out of the box #294

diegovargasf opened this issue Sep 14, 2018 · 3 comments

Comments

@diegovargasf
Copy link

Hello, I followed the instructions here:http://pinaxproject.com/pinax/quick_start/ mainly:
pip install virtualenv
virtualenv mysiteenv
source mysiteenv/bin/activate
pip install pinax-cli
pinax start account mysite

cd mysite
npm install
pip install -r requirements.txt
./manage.py migrate
./manage.py loaddata sites
npm run dev

And when I tried to sign up a new user, after sending the form, I received this error:
Exception Type: AttributeError at /account/signup/
Exception Value: 'AnonymousUser' object has no attribute '_meta'

---------------------------------STACKTRACE COPY-------------------------------------
Environment:
Request Method: POST
Request URL: //localhost:3000/account/signup/

Django Version: 2.1.1
Python Version: 3.6.2
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.messages',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.staticfiles',
'bootstrapform',
'pinax.templates',
'account',
'pinax.eventlog',
'pinax.webanalytics',
'mysite']
Installed Middleware:
['django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback:

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
126. response = self.process_exception_by_middleware(e, request)

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
124. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/django/views/generic/base.py" in view
68. return self.dispatch(request, *args, **kwargs)

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
45. return bound_method(*args, **kwargs)

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/django/views/decorators/debug.py" in sensitive_post_parameters_wrapper
76. return view(request, *args, **kwargs)

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
45. return bound_method(*args, **kwargs)

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapped_view
142. response = view_func(request, *args, **kwargs)

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
45. return bound_method(*args, **kwargs)

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/account/views.py" in dispatch
151. return super(SignupView, self).dispatch(request, *args, **kwargs)

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/django/views/generic/base.py" in dispatch
88. return handler(request, *args, **kwargs)

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/account/views.py" in post
177. return super(SignupView, self).post(*args, **kwargs)

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/django/views/generic/edit.py" in post
142. return self.form_valid(form)

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/account/views.py" in form_valid
243. self.login_user()

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/account/views.py" in login_user
293. auth.login(self.request, user)

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/django/contrib/auth/init.py" in login
126. request.session[SESSION_KEY] = user._meta.pk.value_to_string(user)

File "/Users/diegovargas/myproject/mysiteenv/lib/python3.6/site-packages/django/utils/functional.py" in inner
214. return func(self._wrapped, *args)

Exception Type: AttributeError at /account/signup/
Exception Value: 'AnonymousUser' object has no attribute '_meta'
---------------------------------STACKTRACE COPY END-------------------------------------

Am I missing something?

@diegovargasf
Copy link
Author

Disregard,
I just had to add: "django.contrib.auth.backends.ModelBackend" to my authentication backends

@nstephenh
Copy link

I'm fairly sure this should still be open, as its a bug that does need to be fixed with the template.

@jacobwegner
Copy link
Contributor

I hit this as well on a project; I'm wondering if https://django-user-accounts.readthedocs.io/en/latest/usage.html#using-email-address-for-authentication needs to be updated to ensure that we are adding additional backends to AUTHENTICATION_BACKENDS, rather than overwriting the default setting (which has django.contrib.auth.backends.ModelBackend)

@jacobwegner jacobwegner reopened this Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants