feat(abonnement): linkedin_button paramétrable par next, inscription vers mes-infos

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Colin Maudry
2026-07-04 23:13:11 +02:00
parent a24a96288d
commit cc2b34e84a
3 changed files with 33 additions and 3 deletions
+5 -2
View File
@@ -28,10 +28,13 @@ INFO_MESSAGES = {
}
def linkedin_button():
def linkedin_button(next_url: str | None = None):
href = "/auth/linkedin"
if next_url:
href += f"?next={next_url}"
return html.A(
"Connexion avec LinkedIn",
href="/auth/linkedin",
href=href,
className="btn w-100 mb-2",
style={"backgroundColor": "rgb(10, 102, 194)", "color": "white"},
)
+1 -1
View File
@@ -70,7 +70,7 @@ def layout(error: str | None = None, email: str | None = None, **_):
],
),
html.Div("ou", className="text-center text-muted my-2"),
linkedin_button(),
linkedin_button("/compte/abonnement/mes-infos"),
html.Hr(),
dcc.Link("Déjà un compte ? Se connecter", href="/connexion"),
],
+27
View File
@@ -0,0 +1,27 @@
def test_linkedin_button_default_has_no_next():
# Import app first to initialize Dash
from src.app import app # noqa: F401
from src.pages.connexion import linkedin_button
html_str = str(linkedin_button())
assert "href='/auth/linkedin'" in html_str
assert "next=" not in html_str
def test_linkedin_button_with_next_appends_query():
# Import app first to initialize Dash
from src.app import app # noqa: F401
from src.pages.connexion import linkedin_button
html_str = str(linkedin_button("/compte/abonnement/mes-infos"))
assert "/auth/linkedin?next=/compte/abonnement/mes-infos" in html_str
def test_inscription_linkedin_targets_mes_infos():
# Import app first to initialize Dash
from src.app import app # noqa: F401
from src.pages import inscription
assert "/auth/linkedin?next=/compte/abonnement/mes-infos" in str(
inscription.layout()
)