While the login system works...
It's ripe for abuse though. DMs are federated traffic and are not cryptographically secured in any form. So in theory a bad actor instance admin could spawn unlimited accounts and login... Or just sniff incoming requests from whatever instance this traffic is spawned from and obtain the login code.
For something like this, probably fine... But I wouldn't use it for anything else, nor would I trust any app that does use this system.