Skip to content

flask.Auth.login: pass next_link to self._auth.log_in#28

Merged
rayluo merged 1 commit into
rayluo:devfrom
runxiyu:dev
May 26, 2024
Merged

flask.Auth.login: pass next_link to self._auth.log_in#28
rayluo merged 1 commit into
rayluo:devfrom
runxiyu:dev

Conversation

@runxiyu

@runxiyu runxiyu commented May 21, 2024

Copy link
Copy Markdown

Fixes: #27

Previously, flask.Auth.login does not pass next_link to self._auth.login, so users who complete authentication are passed to /. This commit causes flask.Auth.login to pass next_link to self._auth.login so users could return to the page they are on, when they complete logging in.

@runxiyu

runxiyu commented May 22, 2024

Copy link
Copy Markdown
Author

Uh, apparently I was stupid enough to pass next_link to render_template in my "fixing" commit. (I modified it on two machines and it was wrong on my committing one.)

Fix:

From d2fd5419cc60f82d695d5ca56519bd0aca7c4a72 Mon Sep 17 00:00:00 2001
From: Runxi Yu <me@runxiyu.org>
Date: Wed, 22 May 2024 13:51:54 +0800
Subject: [PATCH v2] flask: Fix the previous commit's stupid mistake of passing
 next_link to render_template rather than login

---
 identity/flask.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/identity/flask.py b/identity/flask.py
index 6a9dfdc..1079682 100644
--- a/identity/flask.py
+++ b/identity/flask.py
@@ -65,6 +65,7 @@ class Auth(WebFrameworkAuth):
         log_in_result = self._auth.log_in(
             scopes=scopes,  # Have user consent to scopes (if any) during log-in
             redirect_uri=self._redirect_uri,
+            next_link=next_link,
             prompt="select_account",  # Optional. More values defined in  https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
             )
         if "error" in log_in_result:
@@ -75,7 +76,6 @@ class Auth(WebFrameworkAuth):
         return render_template("identity/login.html", **dict(
             log_in_result,
             reset_password_url=self._get_reset_password_url(),
-            next_link=next_link,
             auth_response_url=url_for(f"{self._endpoint_prefix}.auth_response"),
             ))
 
-- 
2.45.1

@rayluo rayluo merged commit 5f867d8 into rayluo:dev May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

next_link not used in flask.Auth.login

2 participants