Commit a408c98f authored by Fabien Morin's avatar Fabien Morin

modify EGov_createNewProcedure and EGov_register to ask captcha if a user want...

modify EGov_createNewProcedure and EGov_register to ask captcha if a user want to create a new document without been authenticated.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23322 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 83303fb6
...@@ -67,15 +67,21 @@ ...@@ -67,15 +67,21 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>request=context.REQUEST\n <value> <string>request=context.REQUEST\n
\n \n
portal_type = new_application_procedure\n if context.portal_membership.isAnonymousUser() and not captcha_ok:\n
module = context.getDefaultModule(portal_type=portal_type)\n absolute_url = context.absolute_url()\n
# Create a new procedure\n new_url = \'captcha/CaptchaAdvertisment\'\n
new_procedure = module.newContent(portal_type=portal_type)\n redirect_url = "%s/%s" % (absolute_url, new_url)\n
else:\n
portal_type = new_application_procedure\n
module = context.getDefaultModule(portal_type=portal_type)\n
# Create a new procedure\n
new_procedure = module.newContent(portal_type=portal_type)\n
\n \n
absolute_url = context.absolute_url()\n absolute_url = context.absolute_url()\n
module_id = module.getId()\n module_id = module.getId()\n
new_object_id = new_procedure.getId()\n new_object_id = new_procedure.getId()\n
redirect_url = "%s/%s/%s/%s" % (absolute_url, module_id, new_object_id, \'view\')\n \n
redirect_url = "%s/%s/%s/%s" % (absolute_url, module_id, new_object_id, \'view\')\n
\n \n
result = request[\'RESPONSE\'].redirect(redirect_url) \n result = request[\'RESPONSE\'].redirect(redirect_url) \n
return result\n return result\n
...@@ -101,7 +107,7 @@ return result\n ...@@ -101,7 +107,7 @@ return result\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>new_application_procedure</string> </value> <value> <string>new_application_procedure, captcha_ok=False</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -121,23 +127,25 @@ return result\n ...@@ -121,23 +127,25 @@ return result\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>1</int> </value> <value> <int>2</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>new_application_procedure</string> <string>new_application_procedure</string>
<string>captcha_ok</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>request</string> <string>request</string>
<string>absolute_url</string>
<string>new_url</string>
<string>redirect_url</string>
<string>portal_type</string> <string>portal_type</string>
<string>module</string> <string>module</string>
<string>new_procedure</string> <string>new_procedure</string>
<string>absolute_url</string>
<string>module_id</string> <string>module_id</string>
<string>new_object_id</string> <string>new_object_id</string>
<string>redirect_url</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>result</string> <string>result</string>
</tuple> </tuple>
...@@ -151,13 +159,21 @@ return result\n ...@@ -151,13 +159,21 @@ return result\n
<item> <item>
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<none/> <tuple>
<int>0</int>
</tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>EGov_createNewProcedure</string> </value> <value> <string>EGov_createNewProcedure</string> </value>
</item> </item>
<item>
<key> <string>uid</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>warnings</string> </key> <key> <string>warnings</string> </key>
<value> <value>
......
...@@ -75,7 +75,7 @@ if not context.isCaptchaTextCorrect(captcha_text):\n ...@@ -75,7 +75,7 @@ if not context.isCaptchaTextCorrect(captcha_text):\n
"%s/%s?portal_status_message=%s" %\n "%s/%s?portal_status_message=%s" %\n
(context.absolute_url(), form_id, translated_message))\n (context.absolute_url(), form_id, translated_message))\n
\n \n
return context.EGov_createNewProcedure(new_application_procedure=\'Subscription Form\')\n return context.EGov_createNewProcedure(new_application_procedure=\'Subscription Form\', captcha_ok=True)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -141,6 +141,7 @@ return context.EGov_createNewProcedure(new_application_procedure=\'Subscription ...@@ -141,6 +141,7 @@ return context.EGov_createNewProcedure(new_application_procedure=\'Subscription
<string>message</string> <string>message</string>
<string>translated_message</string> <string>translated_message</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>True</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -310,6 +310,12 @@ ...@@ -310,6 +310,12 @@
</dictionary> </dictionary>
</value> </value>
</item> </item>
<item>
<key> <string>uid</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>values</string> </key> <key> <string>values</string> </key>
<value> <value>
...@@ -361,7 +367,7 @@ ...@@ -361,7 +367,7 @@
</item> </item>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string></string> </value> <value> <string>hidden_label</string> </value>
</item> </item>
<item> <item>
<key> <string>default_params</string> </key> <key> <string>default_params</string> </key>
......
...@@ -242,6 +242,12 @@ ...@@ -242,6 +242,12 @@
</dictionary> </dictionary>
</value> </value>
</item> </item>
<item>
<key> <string>uid</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>values</string> </key> <key> <string>values</string> </key>
<value> <value>
......
270 274
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment