Opened 8 weeks ago

Closed 12 days ago

Last modified 12 days ago

#28645 closed Bug (fixed)

AuthenticationForm's inactive user error isn't raised when using ModelBackend

Reported by: Guilherme Junqueira Owned by: hui shang
Component: contrib.auth Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Looking in file django.contrib.auth.forms

The class AuthenticationForm and clean method.

The inactive user never is raised, this happens because after Django 1.10 all users that is not active cannot authenticate, so self.user_chache is always be None for inactive users, even if has a correct user and pass.

So the code needed to be changed to raise the correct error for a user that is not active.

My stackoverflow thread about this:
https://stackoverflow.com/questions/46459258/how-to-inform-a-user-that-he-is-not-active-in-django-login-view/46459998#46459998

Change History (8)

comment:1 Changed 8 weeks ago by Tim Graham

Summary: The inactive user error never is raised in login formAuthenticationForm's inactive user error isn't raised when using ModelBackend
Triage Stage: UnreviewedAccepted

comment:2 Changed 6 weeks ago by hui shang

Owner: changed from nobody to hui shang
Status: newassigned

comment:3 Changed 3 weeks ago by hui shang

Has patch: set

comment:4 Changed 13 days ago by Tim Graham

Patch needs improvement: set

comment:5 Changed 12 days ago by hui shang

Patch needs improvement: unset

comment:6 Changed 12 days ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 359370a:

Fixed #28645 -- Reallowed AuthenticationForm to raise the inactive user error when using ModelBackend.

Regression in e0a3d937309a82b8beea8f41b17d8b6298da2a86.

Thanks Guilherme Junqueira for the report and Tim Graham for the review.

comment:7 Changed 12 days ago by Tim Graham <timograham@…>

In 36dd0126:

[2.0.x] Fixed #28645 -- Reallowed AuthenticationForm to raise the inactive user error when using ModelBackend.

Regression in e0a3d937309a82b8beea8f41b17d8b6298da2a86.

Thanks Guilherme Junqueira for the report and Tim Graham for the review.

Backport of 359370a8b8ca0efe99b1d4630b291ec060b69225 from master

comment:8 Changed 12 days ago by Tim Graham <timograham@…>

In 308f644:

[1.11.x] Fixed #28645 -- Reallowed AuthenticationForm to raise the inactive user error when using ModelBackend.

Regression in e0a3d937309a82b8beea8f41b17d8b6298da2a86.

Thanks Guilherme Junqueira for the report and Tim Graham for the review.

Backport of 359370a8b8ca0efe99b1d4630b291ec060b69225 from master

Note: See TracTickets for help on using tickets.
Back to Top