mirror of
https://github.com/simple-login/app.git
synced 2025-10-04 20:35:41 +08:00
Capture exception on Login with Proton (#1140)
This commit is contained in:
parent
6d86e64d65
commit
e2f9ea4ae1
1 changed files with 16 additions and 9 deletions
|
@ -15,6 +15,7 @@ from app.config import (
|
||||||
PROTON_VALIDATE_CERTS,
|
PROTON_VALIDATE_CERTS,
|
||||||
URL,
|
URL,
|
||||||
)
|
)
|
||||||
|
from app.log import LOG
|
||||||
from app.proton.proton_client import HttpProtonClient, convert_access_token
|
from app.proton.proton_client import HttpProtonClient, convert_access_token
|
||||||
from app.proton.proton_callback_handler import (
|
from app.proton.proton_callback_handler import (
|
||||||
ProtonCallbackHandler,
|
ProtonCallbackHandler,
|
||||||
|
@ -98,6 +99,7 @@ def proton_callback():
|
||||||
if PROTON_EXTRA_HEADER_NAME and PROTON_EXTRA_HEADER_VALUE:
|
if PROTON_EXTRA_HEADER_NAME and PROTON_EXTRA_HEADER_VALUE:
|
||||||
headers = {PROTON_EXTRA_HEADER_NAME: PROTON_EXTRA_HEADER_VALUE}
|
headers = {PROTON_EXTRA_HEADER_NAME: PROTON_EXTRA_HEADER_VALUE}
|
||||||
|
|
||||||
|
try:
|
||||||
token = proton.fetch_token(
|
token = proton.fetch_token(
|
||||||
_token_url,
|
_token_url,
|
||||||
client_secret=PROTON_CLIENT_SECRET,
|
client_secret=PROTON_CLIENT_SECRET,
|
||||||
|
@ -107,6 +109,11 @@ def proton_callback():
|
||||||
include_client_id=True,
|
include_client_id=True,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
)
|
)
|
||||||
|
except Exception as e:
|
||||||
|
LOG.warning(f"Error fetching Proton token: {e}")
|
||||||
|
flash("There was an error in the login process", "error")
|
||||||
|
return redirect(url_for("auth.login"))
|
||||||
|
|
||||||
credentials = convert_access_token(token["access_token"])
|
credentials = convert_access_token(token["access_token"])
|
||||||
action = get_action_from_state()
|
action = get_action_from_state()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue