From 631e251d8c3c43e6abba6ead436e22994fa0b12f Mon Sep 17 00:00:00 2001 From: Son NK Date: Thu, 11 Jul 2019 20:14:18 +0200 Subject: [PATCH] handle the case user clicks on cancel --- app/auth/views/facebook.py | 5 +++++ app/auth/views/github.py | 5 +++++ app/auth/views/google.py | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/app/auth/views/facebook.py b/app/auth/views/facebook.py index ecd1e2e9..07142eb2 100644 --- a/app/auth/views/facebook.py +++ b/app/auth/views/facebook.py @@ -48,6 +48,11 @@ def facebook_login(): @auth_bp.route("/facebook/callback") def facebook_callback(): + # user clicks on cancel + if "error" in request.args: + flash("please use another sign in method then", "warning") + return redirect("/") + facebook = OAuth2Session( FACEBOOK_CLIENT_ID, state=session["oauth_state"], diff --git a/app/auth/views/github.py b/app/auth/views/github.py index e4eea08f..6ae688fb 100644 --- a/app/auth/views/github.py +++ b/app/auth/views/github.py @@ -39,6 +39,11 @@ def github_login(): @auth_bp.route("/github/callback") def github_callback(): + # user clicks on cancel + if "error" in request.args: + flash("please use another sign in method then", "warning") + return redirect("/") + github = OAuth2Session( GITHUB_CLIENT_ID, state=session["oauth_state"], diff --git a/app/auth/views/google.py b/app/auth/views/google.py index dc1db76d..8113ffe0 100644 --- a/app/auth/views/google.py +++ b/app/auth/views/google.py @@ -48,6 +48,11 @@ def google_login(): @auth_bp.route("/google/callback") def google_callback(): + # user clicks on cancel + if "error" in request.args: + flash("please use another sign in method then", "warning") + return redirect("/") + google = OAuth2Session( GOOGLE_CLIENT_ID, state=session["oauth_state"],