| 123 | |
| 124 | # Add cert for the user |
| 125 | def addCert(self, auth_address, domain, auth_type, auth_user_name, cert_sign): |
| 126 | # Find privatekey by auth address |
| 127 | auth_privatekey = [site["auth_privatekey"] for site in list(self.sites.values()) if site["auth_address"] == auth_address][0] |
| 128 | cert_node = { |
| 129 | "auth_address": auth_address, |
| 130 | "auth_privatekey": auth_privatekey, |
| 131 | "auth_type": auth_type, |
| 132 | "auth_user_name": auth_user_name, |
| 133 | "cert_sign": cert_sign |
| 134 | } |
| 135 | # Check if we have already cert for that domain and its not the same |
| 136 | if self.certs.get(domain) and self.certs[domain] != cert_node: |
| 137 | return False |
| 138 | elif self.certs.get(domain) == cert_node: # Same, not updated |
| 139 | return None |
| 140 | else: # Not exist yet, add |
| 141 | self.certs[domain] = cert_node |
| 142 | self.save() |
| 143 | return True |
| 144 | |
| 145 | # Remove cert from user |
| 146 | def deleteCert(self, domain): |