Skip to content

Conversation

suricactus
Copy link
Collaborator

@suricactus suricactus commented Jul 24, 2025

Since login is a quite a critical part of every application, it would be great if it is always done via a single entrypoint. However, currently the login is handled either via allauth login, or via Django admin login for django admin.

Or in other words, there are accounts/login and admin/login. Suboptimal and fixed in this PR.

What is more, adding a custom admin site for QFieldCloud will allow us to do other "magical" stuff.

In a follow-up PR we need to clean-up the current available configuration on the admin template and provide the same on the allauth template.

Also solves #1259

@duke-nyuki
Copy link
Collaborator

@suricactus
Copy link
Collaborator Author

@tdrivas when I ran the test locally, I couldn't manage to reproduce, any ideas what is wrong?

*[QF-6412-custom_admin][~/work/opengisch/qfieldcloud-private]$ docker compose --env-file .env.test exec app python manage.py test --keepdb qfieldcloud.authentication.tests.test_authentication.QfcTestCase                                         
{"request_id":"none","ts":"2025-07-24T22:30:03.823696","level":"INFO","name":"axes.apps","message":"AXES: BEGIN version 7.0.2, blocking by username","filename":"apps.py","lineno":53,"thread":134119918529408,"source":"app"}
Found 9 test(s).
Using existing test database for alias 'default'...
System check identified no issues (0 silenced).
./usr/local/lib/python3.10/site-packages/allauth/account/app_settings.py:117: UserWarning: app_settings.AUTHENTICATION_METHOD is deprecated, use: app_settings.LOGIN_METHODS
  warnings.warn(
........
----------------------------------------------------------------------
Ran 9 tests in 47.713s

OK
Preserving test database for alias 'default'...

@tdrivas
Copy link
Contributor

tdrivas commented Jul 25, 2025

@tdrivas when I ran the test locally, I couldn't manage to reproduce, any ideas what is wrong?

*[QF-6412-custom_admin][~/work/opengisch/qfieldcloud-private]$ docker compose --env-file .env.test exec app python manage.py test --keepdb qfieldcloud.authentication.tests.test_authentication.QfcTestCase                                         
{"request_id":"none","ts":"2025-07-24T22:30:03.823696","level":"INFO","name":"axes.apps","message":"AXES: BEGIN version 7.0.2, blocking by username","filename":"apps.py","lineno":53,"thread":134119918529408,"source":"app"}
Found 9 test(s).
Using existing test database for alias 'default'...
System check identified no issues (0 silenced).
./usr/local/lib/python3.10/site-packages/allauth/account/app_settings.py:117: UserWarning: app_settings.AUTHENTICATION_METHOD is deprecated, use: app_settings.LOGIN_METHODS
  warnings.warn(
........
----------------------------------------------------------------------
Ran 9 tests in 47.713s

OK
Preserving test database for alias 'default'...

Hey,

I did manage to reproduce by following the steps below:

  1. use of .env.example
  2. Build and start the full stack
  3. Collect static
docker compose run --env-file .env.example --rm app python manage.py collectstatic --noinput
  1. Run the single failing test with the same flags
docker compose --env-file .env.example run --rm app \
  python manage.py test --keepdb \
    qfieldcloud.authentication.tests.test_authentication.QfcTestCase.test_login_with_session_case_insensitive

@suricactus
Copy link
Collaborator Author

@tdrivas thanks, managed to reproduce with the provided steps!

@suricactus suricactus force-pushed the QF-6412-custom_admin branch from a7eed80 to 71cf375 Compare July 26, 2025 11:37
@suricactus
Copy link
Collaborator Author

Do not merge, as the login page being used now is really ugly.

@suricactus suricactus force-pushed the QF-6412-custom_admin branch from efefe61 to 4f53cb7 Compare August 19, 2025 20:52
@suricactus suricactus changed the base branch from master to QF-6412-custom_admin_base August 19, 2025 20:53
Base automatically changed from QF-6412-custom_admin_base to master September 1, 2025 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants