Questions tagged [django-authentication]

django-authentication refers to the built-in auth module for authentication & authorization that can be extended.

django-authentication refers to the built-in auth module for authentication & authorization that can be extended. It handles user accounts, groups, permissions and cookie-based user sessions.

See documentation.

1888 questions
9
votes
2 answers

How do I set session variables at login using django-registration and auth?

I'm using django-registration to log users into my application. That part works fine. The part that I cannot figure out is how to set custom session variables when the user logs in. For instance, I'd like to populate variables containing…
9
votes
1 answer

Is it possible to use django-crispy-form FormHelper without modifying Form class

For the sake of consistency I want to use crispy with my login form. I'm using 'django.contrib.auth.views.login' and I'm only coding the template. The problem is {% crispy form %} doesn’t output submit button nor "next" hidden field. Is there any…
9
votes
6 answers

Django Auth LDAP - Direct Bind using sAMAccountName

There are two ways to authenticate a user using Django Auth LDAP Search/Bind and Direct Bind. The first one involves connecting to the LDAP server either anonymously or with a fixed account and searching for the distinguished name of the…
9
votes
1 answer

When using sub-domains for a Django site, how can you share django logins across sub-domains on localhost?

I want to let the same user session span across: site.com sub1.site.com sub2.site.com I got this to work in production by setting SESSION_COOKIE_DOMAIN to ".site.com", but it doesn't work for me on localhost/dev servers. How do you get it to work…
MikeN
  • 45,039
  • 49
  • 151
  • 227
8
votes
3 answers

Adding extra_context in Django logout built-in view

In django/contrib/auth/views.py there is the definition of the logout view : def logout(request, next_page=None, template_name='registration/logged_out.html', redirect_field_name=REDIRECT_FIELD_NAME, current_app=None,…
Speccy
  • 694
  • 8
  • 30
8
votes
1 answer

Use django PasswordResetView functionality in my own view

I want to use django's default password reset view "PasswordResetView" which let's the user reset his password when he forgets it in a template that already has a view that i built on my own, after looking at the tutorials and the questions i found…
8
votes
3 answers

Django: maintain sessions across multiple domains

I have two/multiple domains say, foo.com and bar.com and both have the same backend, which means both domains redirect the coming requests to same "web instance" hosted somewhere else. Current Behaviour If a user login in foo.com, he/she also need…
JPG
  • 82,442
  • 19
  • 127
  • 206
8
votes
2 answers

How to disable django.contrib.auth completely?

Because I'm using my own authentication and authorization system (with my own User/Permission model), I would like to completely disable this standard app from Django. I've tried removing the relevant lines from MIDDLEWARE_CLASSES…
Sander
  • 83
  • 1
  • 4
8
votes
3 answers

Django REST Framework allow only superusers to access api web view

I'm using Django 2.0 and Django RESET Framework to write REST API for my application. I have configured following authentication methods REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( …
Anuj TBE
  • 9,198
  • 27
  • 136
  • 285
8
votes
7 answers

Can I change Django's auth_user.username field to be 100 chars long without breaking anything?

Before somebody marks this question as a duplicate of this question Can django's auth_user.username be varchar(75)? How could that be done? or other such questions on SO, please read this question. The question I linked to asks this question…
Arpit Rai
  • 1,017
  • 1
  • 13
  • 26
8
votes
6 answers

django authentication package: 'auth' not registered as a namespace

I'm trying to build a simple website with user authentication based on this tutorial, but I'm running into the above error. As per the instructions I set a url as folllows: url('^accounts/', include('django.contrib.auth.urls')) I got this error in…
Shiny_and_Chrome
  • 296
  • 2
  • 12
8
votes
1 answer

AWS Cognito as Django authentication back-end

Does it make sense to attempt to use AWS Cognito as a Django authentication back-end? What would be the advantages of doing so? What would be some challenges / problem areas? Has anyone done any work in this direction?
8
votes
2 answers

Authenticate user after password reset in Django

I use standard Django view, password_reset_confirm(), to reset user's password. After user follows password reset link in the letter, he enters new password and then view redirects him to the site…
Marboni
  • 2,399
  • 3
  • 25
  • 42
8
votes
12 answers

AUTH_USER_MODEL refers to model that has not been installed

I am getting an error ImproperlyConfigured at /admin/ AUTH_USER_MODEL refers to model 'ledger.User' that has not been installed I am only getting it on my production server. Not when I run things via localhost. First it was only when I was making a…
Chase Roberts
  • 9,082
  • 13
  • 73
  • 131
8
votes
1 answer

Duplicate email using both python-social-auth and email registration in Django

I'm using both python-social-auth and email registration in my project. For the user model I use a subclass of AbstractBaseUser: class User(AbstractBaseUser): USERNAME_FIELD = 'email' AUTH_USER_MODEL = 'userprofile.User' But when a user that…