static: Don't use unportable trim() function on login page

Also refactor a bit to avoid code duplication.

Closes #1125
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
tools: Suppress more glib leaks in glib.supp

Leaks found with glib 2.38.2

Closes #1120
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>