I notice the code to have the login result in either an html page or a redirect is somewhat awkwardly distributed between login-form (through fnform) and the login function itself.
I found it helpful to make a base op in srv.arc which outputs no headers, and then my login function was able to itself either output a page, or call a function named redirect with the url which outputs the redirect headers.
Interesting though - I do find it odd that when applying defopl to the root "||" the function doesn't return to the root after login, but rather it fowards to an 'afterward' of "y". Looks as though the code expects that you pass a string in as the afterward and will not take || as an argument.