pontoon icon indicating copy to clipboard operation
pontoon copied to clipboard

Feature: Added an account disabled page

Open RafaelJohn9 opened this issue 1 year ago • 1 comments

this PR addresses issue #3153

RafaelJohn9 avatar Oct 01 '24 04:10 RafaelJohn9

Codecov Report

Attention: Patch coverage is 90.90909% with 3 lines in your changes missing coverage. Please review.

Project coverage is 78.99%. Comparing base (638ae4f) to head (8c0f388). Report is 15 commits behind head on main.

Additional details and impacted files

codecov-commenter avatar Oct 01 '24 05:10 codecov-commenter

Hi @RafaelJohn9, is this ready for review? Could you please rebase it? Do you mind if I do it?

mathjazz avatar Jan 06 '25 12:01 mathjazz

uhmm yea sure @mathjazz , you can take on the issue :handshake: , sorry for the delay

RafaelJohn9 avatar Jan 06 '25 13:01 RafaelJohn9

hey @mathjazz, on second thoughts, lemme complete this :handshake:

RafaelJohn9 avatar Jan 20 '25 08:01 RafaelJohn9

hey @mathjazz , well I've configured everything correctly, issue arises in the AuthenticationMiddleware, it's weird how is_authenticated=true and is_active=false doesn't pass this middleware

RafaelJohn9 avatar Jan 20 '25 14:01 RafaelJohn9

Looking for a way to by pass this :handshake:

RafaelJohn9 avatar Jan 20 '25 15:01 RafaelJohn9

oops, well is_authenticated=False && is_active=False works so yeah :smile:

RafaelJohn9 avatar Jan 20 '25 21:01 RafaelJohn9

The back-end test failure should be unrelated. You will need to rebase once the test is fixed.

flodolo avatar Jan 27 '25 08:01 flodolo

The back-end test failure should be unrelated. You will need to rebase once the test is fixed.

okay :+1:

RafaelJohn9 avatar Jan 27 '25 09:01 RafaelJohn9

@RafaelJohn9 Thanks for addressing the review comments!

This patch doesn't work as expected locally, because if the is_active field is False, the user won't be authenticated during the request lifecycle, and user.is_authenticated will always be False. See the docs for more details.

We use a different authentication backend on stage / prod, which already serves inactive accounts with the account_inactive.html page after they try to log in. Sorry for not noticing this earlier!

I suggest we drop the middleware changes (incl. the test) as they are not necessary, and override the default template used by django-allauth (see https://github.com/mozilla/pontoon/tree/main/pontoon/base/templates/django). Note that these need to be Django, rather than jinja2 templates.

mathjazz avatar Feb 11 '25 13:02 mathjazz

Closing due to inactivity, please re-open if you want to continue. Thanks for the effort so far!

mathjazz avatar Apr 08 '25 10:04 mathjazz