Item12926: Subscribe links on top and bottom bar fail with validation errors
Priority: Urgent
Current State: Closed
Released In: 1.2.0
Target Release: minor
Applies To: Extension
Component:
Branches: master
These buttons need the "subscribe_button" class added, so that the
SubscribePlugin javascript will convert the GET to a POST.
--
GeorgeClark - 30 May 2014
I added the subscribe_button class to the links by updating
- templates/view.famfamfam.tmpl
- viewtopicactionbuttons.tmpl
However this doesn't seem to accomplish converting the GET to a POST.
I get the following js error:
Timestamp: 06/01/2014 07:44:20 PM
Error: TypeError: form is undefined
Source File: http://mytestsite.com/pub/System/JavascriptFiles/strikeone.js
Line: 207
--
GeorgeClark - 01 Jun 2014
Adding the subscribe_button class isn't enough. It requires a form around the button, in order to pass the strikeone validation key. This form is serialized and sent with the POST.
Of course the JS could be rewritten to avoid this, though it would still have to reap the strikeone key from some other form on the page.
--
CrawfordCurrie - 08 Jun 2014
StephanOsthold pointed out that not all pages have a form available to harvest. The simple fix is to allow get URLs to subscribe / unsubscribe. Since this can only be used by a logged in user and has minimal impact, it's probably okay to relax the rest restriction for this extension.
--
GeorgeClark - 21 Jul 2014
I've got a couple of issues:
- The subscribe / unsubscribe when executed as a get URL result in a json response to the browser. this will be confusing. I the request is a get, then the rest handler probably ought to reply with an oops message so that the user can click to get back to the original page.
- There is an issue in UI::Rest. If you use a GET request, validation is still verified. Since validation only is applicable to POST type requests, we can probably skip validation for GET requests provided that GET is allowed.
--
GeorgeClark - 22 Jul 2014
Because HTML doesn't support forms inside forms, using a form will never work for the variety of top and bottom bar implementations we have. So I recoded it to use a "special" validation token reserved for the use of the plugin.
--
Main.CrawfordCurrie - 24 Nov 2014 - 17:59