Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: login in debug/dev mode #829

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Conversation

vincentporte
Copy link
Contributor

@vincentporte vincentporte commented Nov 18, 2024

Description

🎸 lorsque le mode DEBUG est actif:

  • afficher le lien magique de connexion au lieu d'utiliser les routes django.contrib.auth.urls
  • afficher une bannière rouge

Type de changement

🎢 Nouvelle fonctionnalité (changement non cassant qui ajoute une fonctionnalité).
🚧 technique

Points d'attention

🦺 passage de la valeur de la variable DEBUG dans le context_processor

Captures d'écran (optionnel)

Banniere Debug Mode

image

Lien cliquable d'authentification en mode debug

image

@vincentporte vincentporte added python Pull requests that update Python code technical debt labels Nov 18, 2024
@@ -38,6 +40,10 @@ def send_magic_link(user, next_url):
template_id=settings.SIB_MAGIC_LINK_TEMPLATE,
)

if settings.DEBUG is True:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tu as besoin d'ajouter cette spécificité pour le debug ? est-ce que le mode de production ne devrait pas suffir ?

Comment on lines +72 to +74
<div id="debug-mode-banner">
{% if DEBUG %}<div class="bg-danger text-white mt-3">DEBUG MODE</div>{% endif %}
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On pourrait wrapper le div entière dans le {% if %} pour ne pas avoir la div#debug-mode-banner en prod.

@@ -38,6 +40,10 @@ def send_magic_link(user, next_url):
template_id=settings.SIB_MAGIC_LINK_TEMPLATE,
)

if settings.DEBUG is True:
message = mark_safe(f'<a href="{login_link}">Login link</a> sent to {user.email}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ce n’est pas safe. format_html avec deux paramètres ?

Comment on lines +22 to +31
@override_settings(
DEBUG=True,
INSTALLED_APPS=[app for app in settings.INSTALLED_APPS if app != "debug_toolbar"],
MIDDLEWARE=[
middleware
for middleware in settings.MIDDLEWARE
if middleware != "debug_toolbar.middleware.DebugToolbarMiddleware"
],
DEBUG_TOOLBAR_CONFIG={},
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tu ne voulais pas réutiliser la fixture override_debug_toolbar_settings_fixture ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests that update Python code technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants