created the current user method and the ensure logged in methos