diff --git a/web/src/views/DeviceRegistration/RegisterOneTimePassword.tsx b/web/src/views/DeviceRegistration/RegisterOneTimePassword.tsx index 686776076..560ebd47a 100644 --- a/web/src/views/DeviceRegistration/RegisterOneTimePassword.tsx +++ b/web/src/views/DeviceRegistration/RegisterOneTimePassword.tsx @@ -47,7 +47,15 @@ const RegisterOneTimePassword = function () { setSecretBase32(secret.base32_secret); } catch (err) { console.error(err); - createErrorNotification("Failed to generate the code to register your device", 10000); + if ((err as Error).message.includes("Request failed with status code 403")) { + createErrorNotification( + "You must open the link from the same device and browser that initiated the registration process", + ); + } else { + createErrorNotification( + "Failed to register device, the provided link is expired or has already been used", + ); + } setHasErrored(true); } setIsLoading(false); diff --git a/web/src/views/DeviceRegistration/RegisterSecurityKey.tsx b/web/src/views/DeviceRegistration/RegisterSecurityKey.tsx index 57a575c30..9ae8ff20b 100644 --- a/web/src/views/DeviceRegistration/RegisterSecurityKey.tsx +++ b/web/src/views/DeviceRegistration/RegisterSecurityKey.tsx @@ -46,9 +46,15 @@ const RegisterSecurityKey = function () { navigate(FirstFactorPath); } catch (err) { console.error(err); - createErrorNotification( - "Failed to register your security key. The identity verification process might have timed out.", - ); + if ((err as Error).message.includes("Request failed with status code 403")) { + createErrorNotification( + "You must open the link from the same device and browser that initiated the registration process", + ); + } else { + createErrorNotification( + "Failed to register your security key. The identity verification process might have timed out.", + ); + } } }, [processToken, createErrorNotification, navigate]);