*** This bug is a duplicate of bug 867459 *** https://bugs.launchpad.net/bugs/867459
Even though this bug came first, I'm marking it as a duplicate of the later bug. Sorry about that.
I think the approach outlined in the duplicate should work for Postorius (the web ui).
** This bug has been marked a duplicate of bug 867459 REST API: Implement a simple way to check user credentials