Turning off the external monitor unlocks the screen

I regularly use an external monitor along with the laptop monitor. With the screen locked, when the external monitor is turned off or goes to sleep, the screen is unlocked in the internal monitor. This happens systematically, to reproduce it:

  • Lock the screen from the menu
  • Turn off the external monitor.

This is annoying as I have to disable the monitor auto-off to avoid leaving the desk unlocked.

Duplicate or similar to this [Security] Bypass login screen by plugging second monitor