Group choice during the registration


I want to force people to choose a group during their registration. So, i have modified the file /templates/modal/create_account.hbs in order to insert a new field. But i m unable to get the groups.
How can i do? I have tried to use Discourse.Site.currentProp(‘groups’), but it returns all groups (not only the public groups). And how to create the select input after and to save the new registration (with the group)?
In the parameters, i have created new user field ‘group’ in the administration, but i don’t understand because i have recreated the same groups as groups users… but there are no link between them?!..
ty for your help