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:
@@ -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(
|
return html.A(
|
||||||
"Connexion avec LinkedIn",
|
"Connexion avec LinkedIn",
|
||||||
href="/auth/linkedin",
|
href=href,
|
||||||
className="btn w-100 mb-2",
|
className="btn w-100 mb-2",
|
||||||
style={"backgroundColor": "rgb(10, 102, 194)", "color": "white"},
|
style={"backgroundColor": "rgb(10, 102, 194)", "color": "white"},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ def layout(error: str | None = None, email: str | None = None, **_):
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
html.Div("ou", className="text-center text-muted my-2"),
|
html.Div("ou", className="text-center text-muted my-2"),
|
||||||
linkedin_button(),
|
linkedin_button("/compte/abonnement/mes-infos"),
|
||||||
html.Hr(),
|
html.Hr(),
|
||||||
dcc.Link("Déjà un compte ? Se connecter", href="/connexion"),
|
dcc.Link("Déjà un compte ? Se connecter", href="/connexion"),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -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()
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user