Make login work with database