You can set the templates directory to anything in plugin.json, I think it defaults to just templates if you don't specify.
Them you match the path from views, so it would be templates/emails where you put them.
I want to only allow users from specific domains to register (e.g. only people with @gmail.com emails).
Seems like I can somehow use filter:register.interstitial hook, but not sure exactly how (and it seems I'd have to duplicate all the existing email validation logic).
What's the best way to go about this?
Maybe this helps https://gitlab.com/frissdiegurke/nodebb-plugin-email-whitelist.
@baris Thanks for the quick response!
Not in front of a computer right now, but AFAICT this plugin hooks to the filter:register.check which fires after username and password are provided, but before email is provided (which happens later via interstitials).
Maybe things changed since it was written?
What am I missing?
Hmm yeah you are right, email got removed from register page.
Did you try throwing an error in filter:register.interstitial if email confirmation is from wrong domain?
@nir-s Ah, hm... yes that seems to be a functionality regression that I had not considered when I refactored the email handling.
@baris IIUC the function registered to filter:register.interstitial adds objects to data.interstitial with template, data and callback.
It seems callback is optional, but template isn't.
I tried using a callback to verify the email to throw an error when it fails, but looks like I have to specify a template (which I don't need).
I guess I can try to add an empty template, but I'm wondering if there's a better way.
Actually even if I add an empty template, by the time the hook for checking the domain of the email triggers, the email interstitial would already update the non-validated email in the database and send a confirmation email ...
@baris That was fast Thanks!
I'll check it out and update.