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/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(".*<input .* name=['\"](.+?)['\"].*value=['\"](.+?)['\"]", line) - if m: - name, value = m.groups() - inputs[name] = value.strip("'\"") - return inputs - def _extract_path_from_response(self, response: TestResponse) -> str: return self._extract_path_from_info({"headers": response.headers}) 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