Add username check endpoint, improve login handler