Skip to content

Commit

Permalink
[project @ #220 server.rb Fix to_form_markup to use the return_to frr…
Browse files Browse the repository at this point in the history
…om the request]
  • Loading branch information
tailor committed Jun 4, 2008
1 parent 3ba8999 commit 028d074
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 1 addition & 3 deletions lib/openid/server.rb
Expand Up @@ -873,9 +873,7 @@ def to_s
# it will be replaced.
# Returns the form markup for this response.
def to_form_markup(form_tag_attrs=nil)
return @fields.to_form_markup(
@fields.get_arg(OPENID_NS, 'return_to'),
form_tag_attrs)
return @fields.to_form_markup(@request.return_to, form_tag_attrs)
end

# Wraps the form tag from to_form_markup in a complete HTML document
Expand Down
15 changes: 15 additions & 0 deletions test/test_server.rb
Expand Up @@ -859,6 +859,21 @@ def test_cancel
assert(webresponse.headers.member?('location'))
end

def test_cancel_to_form
request = Server::CheckIDRequest.new(
'http://bombom.unittest/',
'http://burr.unittest/999',
@server.op_endpoint,
'http://burr.unittest/',
false, nil)
response = Server::OpenIDResponse.new(request)
response.fields = Message.from_openid_args({
'mode' => 'cancel',
})
form = response.to_form_markup
assert(form.index(request.return_to))
end

def test_assocReply
msg = Message.new(OPENID2_NS)
msg.set_arg(OPENID2_NS, 'session_type', 'no-encryption')
Expand Down

0 comments on commit 028d074

Please sign in to comment.