From 99a1b32ff09409299c579b478cf66f52079ded73 Mon Sep 17 00:00:00 2001 From: Johan Lundberg Date: Mon, 23 Sep 2024 09:26:56 +0200 Subject: [PATCH 1/2] show during login if the current user has a verified phone number --- src/eduid/webapp/idp/schemas.py | 1 + src/eduid/webapp/idp/views/next.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/eduid/webapp/idp/schemas.py b/src/eduid/webapp/idp/schemas.py index c4a1a61e6..34431b339 100644 --- a/src/eduid/webapp/idp/schemas.py +++ b/src/eduid/webapp/idp/schemas.py @@ -32,6 +32,7 @@ class AuthnOptionsResponsePayload(EduidSchema): username = fields.Bool(required=False) usernamepassword = fields.Bool(required=False) webauthn = fields.Bool(required=True) + verified_phone_number = fields.Bool(required=True) class ServiceInfoResponsePayload(EduidSchema): display_name = fields.Dict(keys=fields.Str(), values=fields.Str(), required=False) diff --git a/src/eduid/webapp/idp/views/next.py b/src/eduid/webapp/idp/views/next.py index 32dc03f40..c05928283 100644 --- a/src/eduid/webapp/idp/views/next.py +++ b/src/eduid/webapp/idp/views/next.py @@ -231,6 +231,8 @@ class AuthnOptions: username: bool = True # Can an unknown user log in using a webauthn credential? No, not at this time (might be doable). webauthn: bool = False + # Temporary option for displaying info about removing phone numbers + verified_phone_number: bool = False def to_dict(self) -> dict[str, Any]: return asdict(self) @@ -332,6 +334,10 @@ def _set_user_options(res: AuthnOptions, eppn: str) -> None: current_app.logger.debug("User has a FIDO/Webauthn credential") res.webauthn = True + if user.phone_numbers.verified: + current_app.logger.debug("User has a verified phone number") + res.verified_phone_number = True + if user.locked_identity.nin: current_app.logger.debug("User has a locked NIN -> swedish eID is possible") res.freja_eidplus = True From 3647a047427b4d834c583760d81ee4129bc1d96d Mon Sep 17 00:00:00 2001 From: Johan Lundberg Date: Mon, 23 Sep 2024 09:27:39 +0200 Subject: [PATCH 2/2] remove deprecated test method --- src/eduid/webapp/idp/tests/test_api.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/eduid/webapp/idp/tests/test_api.py b/src/eduid/webapp/idp/tests/test_api.py index 85ee636b9..8630e48cc 100644 --- a/src/eduid/webapp/idp/tests/test_api.py +++ b/src/eduid/webapp/idp/tests/test_api.py @@ -338,18 +338,6 @@ def _call_mfa( result = MfaResult(payload=self.get_response_payload(response)) return result - @staticmethod - def _extract_form_inputs(res: str) -> dict[str, Any]: - inputs = {} - for line in res.split("\n"): - if "input" in line: - # YOLO - m = re.match(".* str: return self._extract_path_from_info({"headers": response.headers})