It may not be a exact solution. But you may get some help with this plugin below
https://github.com/vinothkannans/discourse-guest-gate.git