The easiest way to achieve this is to set a cookie for that user after he ticks the box. The cookie should store a UUID that you also have in DB and is specific to this user and device. After the user logs in and before prompting for 2FA you can check for the presence of this cookie and query the DB to make sure it is valid.
For more advanced options check this post: https://email@example.com/making-two-factor-authentication-more-user-friendly-through-trusted-devices-257acc27b24b
To manipulate the request and response you will need some java see https://forum.mendix.com/link/questions/104358