I don't think you can differentiate between /user/login and /user/login# But you can easily differentiate between /user/login and user/login?code=
Note: "/user/login?code=" and "/user/login#_=_?code=" will look identical
to the server. The # tells the browser (and only the browser) where to
scroll to show the anchor.
if request.vars.code:
...

