How to implement a Jira plugin that limit account name allowed at SignUp?

I want to write a Jira plugin that force people to use a certain username pattern when they register their accounts in Jira.

This is happening inside the form is displayed at `/secure/Signup!default.jspa` and is based on `$JIRA_INSTALL/atlassian-jira/views/signup.jsp` view.

Still, I have no idea what to put inside the plugin in order to make it fail, and also I do not want to go the easy way and implement this in JavaScript on the client, not because of security, just because I want a solution that does not brake when you upgrade Jira.

Update: I found that DefaultUserService.java - still I'm not sure how to implement this in a plugin and preferably writing a minimal amount of code.

Probably what I need is to throw a CreateExeption from inside the plugin, but what to implement inside the plugin to throw this?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...