mirror of
https://github.com/certbot/certbot.git
synced 2026-07-27 16:30:31 +02:00
Registration: TOS and agreement
This commit is contained in:
@@ -117,7 +117,7 @@ class RegistrationResource(Resource):
|
||||
:ivar new_authz_uri: URI found in the 'next' Link header
|
||||
|
||||
"""
|
||||
__slots__ = ('body', 'uri', 'new_authz_uri')
|
||||
__slots__ = ('body', 'uri', 'new_authz_uri', 'terms_of_service')
|
||||
|
||||
|
||||
class Registration(ResourceBody):
|
||||
@@ -128,6 +128,7 @@ class Registration(ResourceBody):
|
||||
key = jose.Field('key', omitempty=True, decoder=jose.JWK.from_json)
|
||||
contact = jose.Field('contact', omitempty=True, default=())
|
||||
recovery_token = jose.Field('recoveryToken', omitempty=True)
|
||||
agreement = jose.Field('agreement', omitempty=True)
|
||||
|
||||
|
||||
class ChallengeResource(Resource, jose.JSONObjectWithFields):
|
||||
|
||||
@@ -36,14 +36,19 @@ class Network(object):
|
||||
|
||||
def register(self, contact=messages2.Registration._fields['contact'].default):
|
||||
new_reg = messages2.Registration(contact=contact)
|
||||
|
||||
response = self._post(self.new_reg_uri, self._wrap_in_jws(new_reg))
|
||||
assert response.status_code == httplib.CREATED # TODO: handle errors
|
||||
|
||||
terms_of_service = (response.links['next']['url']
|
||||
if 'terms-of-service' in response.links else None)
|
||||
regr = messages2.RegistrationResource(
|
||||
body=messages2.Registration.from_json(response.json()),
|
||||
uri=response.headers['location'],
|
||||
new_authz_uri=response.links['next']['url'],
|
||||
)
|
||||
terms_of_service=terms_of_service)
|
||||
assert regr.body.key == self.key.public()
|
||||
|
||||
return regr
|
||||
|
||||
def update_registration(self, regr):
|
||||
|
||||
Reference in New Issue
Block a user