setUser now accepts function, for use in Express handler