How did you integrated AD? If you use following module for AD; after their login, users remain signed in until their AD session expires. This way you may achieve your desired result without writing custom logic.
https://marketplace.mendix.com/link/component/1174
If you have a custom login logic, extend Account entity by adding LoginToken attribute. Place a "Remember me" checkbox in the login form and if the checkbox is true generate a random token for LoginToken and store it in the account entity. Also save this generated token in the user’s browser (e.g. via a cookie using a JavaScript action).
When user visits page, login logic shall check if a valid token exists in the user cookie, if a valid token exists in the browser, find the corresponding Account and trigger the log the user in.