Signature of method sso_failure() is changed to match the name name of
the context variable in template mellon/authentication_failed.html
(idp_message => reason).
Use it by putting a tag:
<iframe height="0" width="0" src="{% url "mellon_login" %}?{{ request.GET.urlencode }}&passive&iframe"></iframe>
in your page. It will do a passive authentication inside the iframe and
will use JS to reload the top frame if authentication is successfull.