Modified authentication manager to work with database.