fix
use middleware to log in the user
add log