I created a default TextBox skin to trim spaces from all textboxes. Works nicely. And it handles the spaces in the login control. I also created a "no trim" skin that I can apply to textboxes where I want to permit leading or trailing spaces, but that's rarely necessary.
<asp:TextBox runat="server" onblur="this.value = this.value.replace(/(^\s*)|(\s*$)|(^\n*)|(\n*$)/g, '');" CssClass="text input" />
You could probably also do the same thing with a jQuery bind or live function.
I think it's easier than messing with SF templates.