I am pretty new at this and trying to create a lightning component so that community users that can't remember their username are able to enter an email address to retrieve their username. If the email they enter matches an existing user account's listed email address it will kick an email to that address with the username of the account. Anyone have anything or knowledge of an open source resource that might have something similar? Thank you!
Whenever you create a Community(Napili) on the Salesforce for the first time, some custom sample lightning components(with standard functionality) will be added/installed. We just need to make simple changes and make use of them on the right community pages to make them work. Those components include: Login Form, Self-Registeration, Forgot Password and SetStartUrl. To have the Forgot Username functionality(which is not available by default), you should customize LoginForm component to have it.
I see that you already have an implementation logic, go ahead and try it out. Also it is always better to search on Google, so that you may find someone already tried this and stuck and posted on SFSE (or) a blog post (or) some useful implementation documentation. If you stuck at some point, post your issue/blocker here along with the relevant code sample and people here are happy to help.
Here is some supporting documentation I found on the sample components that I have mentioned above: