Commit 661783ef authored by Alain Takoudjou's avatar Alain Takoudjou

slapos_web: update certificate generation form

parent 2344625d
"""
If certificate_request is None will only create the computer without
generate a certificate.
"""
portal = context.getPortalObject() portal = context.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue() person = portal.ERP5Site_getAuthenticatedMemberPersonValue()
...@@ -10,7 +15,8 @@ else: ...@@ -10,7 +15,8 @@ else:
request_kw = dict(computer_title=title) request_kw = dict(computer_title=title)
person.requestComputer(**request_kw) person.requestComputer(**request_kw)
computer = context.restrictedTraverse(context.REQUEST.get('computer')) computer = context.restrictedTraverse(context.REQUEST.get('computer'))
computer.generateCertificate() if certificate_request is not None:
computer.generateCertificate(certificate_request=certificate_request)
message = "Registering Computer" message = "Registering Computer"
context.REQUEST.set("portal_status_message", message) context.REQUEST.set("portal_status_message", message)
return computer.Computer_viewConnectionInformationAsWeb() return computer.Computer_viewConnectionInformationAsWeb()
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>title</string> </value> <value> <string>title, certificate_request=None</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
computer = context computer = context
request = context.REQUEST request = context.REQUEST
try: try:
computer.generateCertificate(csr=certificate_signature_request) computer.generateCertificate(certificate_request=certificate_signature_request)
request.set('portal_status_message', context.Base_translateString('Certificate created.')) request.set('portal_status_message', context.Base_translateString('Certificate created.'))
except ValueError: except ValueError:
request.set('portal_status_message', context.Base_translateString('Certificate is still active, please revoke existing one.')) request.set('portal_status_message', context.Base_translateString('Certificate is still active, please revoke existing one.'))
......
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
</item> </item>
<item> <item>
<key> <string>height</string> </key> <key> <string>height</string> </key>
<value> <int>10</int> </value> <value> <int>15</int> </value>
</item> </item>
<item> <item>
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>width</string> </key> <key> <string>width</string> </key>
<value> <int>80</int> </value> <value> <int>65</int> </value>
</item> </item>
</dictionary> </dictionary>
</value> </value>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="StringField" module="Products.Formulator.StandardFields"/> <global name="LinkField" module="Products.Formulator.StandardFields"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
...@@ -18,6 +18,10 @@ ...@@ -18,6 +18,10 @@
<key> <string>external_validator_failed</string> </key> <key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value> <value> <string>The input failed the external validator.</string> </value>
</item> </item>
<item>
<key> <string>not_link</string> </key>
<value> <string>The specified link is broken.</string> </value>
</item>
<item> <item>
<key> <string>required_not_found</string> </key> <key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value> <value> <string>Input is required but no input given.</string> </value>
...@@ -37,6 +41,14 @@ ...@@ -37,6 +41,14 @@
<key> <string>alternate_name</string> </key> <key> <string>alternate_name</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>check_link</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>check_timeout</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -81,6 +93,10 @@ ...@@ -81,6 +93,10 @@
<key> <string>input_type</string> </key> <key> <string>input_type</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>link_type</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>max_length</string> </key> <key> <string>max_length</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -116,6 +132,14 @@ ...@@ -116,6 +132,14 @@
<key> <string>alternate_name</string> </key> <key> <string>alternate_name</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>check_link</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>check_timeout</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -160,6 +184,10 @@ ...@@ -160,6 +184,10 @@
<key> <string>input_type</string> </key> <key> <string>input_type</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>link_type</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>max_length</string> </key> <key> <string>max_length</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -195,9 +223,17 @@ ...@@ -195,9 +223,17 @@
<key> <string>alternate_name</string> </key> <key> <string>alternate_name</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>check_link</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>check_timeout</string> </key>
<value> <float>7.0</float> </value>
</item>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string></string> </value> <value> <string>nolabel</string> </value>
</item> </item>
<item> <item>
<key> <string>default</string> </key> <key> <string>default</string> </key>
...@@ -213,11 +249,11 @@ ...@@ -213,11 +249,11 @@
</item> </item>
<item> <item>
<key> <string>display_width</string> </key> <key> <string>display_width</string> </key>
<value> <int>40</int> </value> <value> <int>20</int> </value>
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
...@@ -239,6 +275,10 @@ ...@@ -239,6 +275,10 @@
<key> <string>input_type</string> </key> <key> <string>input_type</string> </key>
<value> <string>text</string> </value> <value> <string>text</string> </value>
</item> </item>
<item>
<key> <string>link_type</string> </key>
<value> <string>external</string> </value>
</item>
<item> <item>
<key> <string>max_length</string> </key> <key> <string>max_length</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
......
...@@ -88,7 +88,6 @@ ...@@ -88,7 +88,6 @@
<list> <list>
<string>your_description</string> <string>your_description</string>
<string>my_certificate_signature_request</string> <string>my_certificate_signature_request</string>
<string>your_common_name</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -88,7 +88,6 @@ ...@@ -88,7 +88,6 @@
<list> <list>
<string>your_description</string> <string>your_description</string>
<string>my_certificate_signature_request</string> <string>my_certificate_signature_request</string>
<string>your_common_name</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -97,7 +97,6 @@ ...@@ -97,7 +97,6 @@
<string>my_reference</string> <string>my_reference</string>
<string>your_computer_url</string> <string>your_computer_url</string>
<string>your_certificate</string> <string>your_certificate</string>
<string>your_key</string>
</list> </list>
</value> </value>
</item> </item>
......
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