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
10
votes
7 answers

Django auth.user with unique email

I use the django.auth system and I've this: class RegisterForm(UserCreationForm): username = forms.RegexField(label= "Username" , max_length = 30, regex = r'^[\w]+$', error_messages = {'invalid': "This value may contain only letters, numbers and…
Fred Collins
  • 5,004
  • 14
  • 62
  • 111
10
votes
4 answers

Django: Why create a OneToOne to UserProfile instead of subclassing auth.User?

Note: If you are tempted to 'answer' this question by telling me that you don't like django.contrib.auth, please move on. That will not be helpful. I am well aware of the range and strength of opinions on this matter. Now, the question: The…
10
votes
3 answers

How to manually authenticate after get django user?

Im writing a facebook-connect app that login user after authenticate session on facebook, question is how can i authenticate user on django after get user object? user = User.objects.get(email=email) user = authenticate(username=user.username,…
marman
  • 417
  • 1
  • 4
  • 16
10
votes
2 answers

Django - user is_active

This is my user authentication method: def user_login(request): if request.method == 'POST': username = request.POST.get('username') password = request.POST.get('password') user = authenticate(username=username,…
jundymek
  • 1,013
  • 4
  • 18
  • 40
10
votes
1 answer

Where does Django store auth's superuser / pw / e-mail data?

After running syncdb and creating a su, where does that get recorded? Settings.py doesn't seem to change.
fooba
  • 269
  • 3
  • 6
10
votes
3 answers

How to get Django view to return form errors

This is my view: def main_page(request): if request.method == 'POST': form = RegistrationForm(request.POST) if form.is_valid(): user = User.objects.create_user( username=form.clean_data['username'], …
SilentDev
  • 20,997
  • 28
  • 111
  • 214
10
votes
2 answers

How to create multiple signup pages with django-allauth?

I have one custom user model that contains a number of fields in addition to email and password. One field is user_type which is set to either designer or developer. Other fields are specific to one or the other type. I need to have a separate…
KrisF
  • 1,371
  • 13
  • 27
10
votes
2 answers

Objects with permissions assigned by django-guardian not visible in admin

I'm using django-guardian in order to manage per object permission. For a given user I give permission all permission on one object: joe = User.objects.get(username="joe") mytask = Task.objects.get(pk=1) assign('add_task', joe,…
jul
  • 36,404
  • 64
  • 191
  • 318
9
votes
3 answers

Django How to prevent multiple users login using the same credentials

I am developing an Django application using django auth module and would like to prevent multiple login using the same user name and password. It should prevent multiple logins on different machines using the same user name and password. How do I…
AKV
  • 171
  • 1
  • 4
  • 12
9
votes
1 answer

In Django, how can you get all related objects with a particular User foreign Key

I have something like this: class Video(models.Model): user = models.ForeignKey(User, related_name='owner') ... and I'm trying to access all the videos a particular user has by doing something like: u =…
9-bits
  • 10,395
  • 21
  • 61
  • 83
9
votes
2 answers

Getting `django-registration` to send you to the page you were originally trying to visit

django.contrib.auth has an awesome feature: When you try to access a page that's decorated by login_required, you get redirected to the login page with a next argument, so after you login you get redirected back to the page you were originally…
Ram Rachum
  • 84,019
  • 84
  • 236
  • 374
9
votes
1 answer

Modifying Django UserCreationForm

I wanted to add more fields to the standard Django UserCreationForm so I went ahead and subclassed it inside of my app's forms.py file and ended up with this: class CustomUserCreationForm(UserCreationForm): email = forms.EmailField(label =…
CCSab
  • 1,455
  • 3
  • 16
  • 27
9
votes
1 answer

Unable to create an integration test for Django's reset password flow

I'm trying to implement an integration test for the password reset flow, but I'm stuck at the "password_reset_confirm" view. I already tested the flow manually, and it works fine. Unfortunately, the Django unit test client seems unable to follow…
9
votes
1 answer

Implement Django Simple Captcha with the existing django.contrib.auth.forms

I would like to add captcha on my django registration form using Django Simple Captcha found here: http://code.google.com/p/django-simple-captcha/ This works great if you create a new form but I'm using the django.contrib.auth.forms the one that…
avatar
  • 12,087
  • 17
  • 66
  • 82
9
votes
1 answer

Django auth model Error: name 'User' is not defined

1. The error codes: NameError: name 'User' is not defined >>> myproject ME$ python manage.py shell NameError: name 'User' is not defined myproject ME$ python manage.py shell Python 2.7.5 (default, Mar 9 2014, 22:15:05) [GCC 4.2.1 Compatible Apple…