fix login and move it's validation to backend

while attempting to move login validation to the backend i ran into
a bug with the username->user function that caused friend to throw a
null pointer when trying to authenticate a non-existant user. the
issue was that username->user returned an empty map when it could
not find the user instead of nil. solved by checking for an empty
map returned from the db select. login validation now takes place in
the backend