Update login to use logmessages function instead of writing straight to session variable