I just noticed a small bug: sometimes the "+" which are part of the title of a page are not being escaped when added to "returnto" paramter in URL. This should be fixed, so that the user is redirected to the correct page after login.
Here are the steps I followed to get the error:
I was at this page:
http://pt.wikibooks.org/w/index.php?title=Discuss%C3%A3o:Programar_em_C%2B%2B&action=edit&oldid=202181
Then I clicked in logout:
http://pt.wikibooks.org/w/index.php?title=Especial:Sair&returnto=Discuss%C3%A3o:Programar_em_C%2B%2B&returntoquery=action%3Dedit%26oldid%3D202181
And then login:
http://pt.wikibooks.org/w/index.php?title=Especial:Entrar&returnto=Discuss%C3%A3o:Programar_em_C++
After login, the URL was:
http://pt.wikibooks.org/w/index.php?title=Especial:Entrar&action=submitlogin&type=login&returnto=Discuss%C3%A3o:Programar_em_C++
and the target page was:
http://pt.wikibooks.org/wiki/Discuss%C3%A3o:Programar_em_C
instead of
http://pt.wikibooks.org/wiki/Discuss%C3%A3o:Programar_em_C%2B%2B
Version: unspecified
Severity: enhancement