(self, to, domain, auth_type, auth_user_name, cert)
| 728 | |
| 729 | # Add certificate to user |
| 730 | def actionCertAdd(self, to, domain, auth_type, auth_user_name, cert): |
| 731 | try: |
| 732 | res = self.user.addCert(self.user.getAuthAddress(self.site.address), domain, auth_type, auth_user_name, cert) |
| 733 | if res is True: |
| 734 | self.cmd( |
| 735 | "notification", |
| 736 | ["done", _("{_[New certificate added]:} <b>{auth_type}/{auth_user_name}@{domain}</b>.")] |
| 737 | ) |
| 738 | self.user.setCert(self.site.address, domain) |
| 739 | self.site.updateWebsocket(cert_changed=domain) |
| 740 | self.response(to, "ok") |
| 741 | elif res is False: |
| 742 | # Display confirmation of change |
| 743 | cert_current = self.user.certs[domain] |
| 744 | body = _("{_[Your current certificate]:} <b>{cert_current[auth_type]}/{cert_current[auth_user_name]}@{domain}</b>") |
| 745 | self.cmd( |
| 746 | "confirm", |
| 747 | [body, _("Change it to {auth_type}/{auth_user_name}@{domain}")], |
| 748 | lambda res: self.cbCertAddConfirm(to, domain, auth_type, auth_user_name, cert) |
| 749 | ) |
| 750 | else: |
| 751 | self.response(to, "Not changed") |
| 752 | except Exception as err: |
| 753 | self.log.error("CertAdd error: Exception - %s (%s)" % (err.message, Debug.formatException(err))) |
| 754 | self.response(to, {"error": err.message}) |
| 755 | |
| 756 | def cbCertAddConfirm(self, to, domain, auth_type, auth_user_name, cert): |
| 757 | self.user.deleteCert(domain) |
nothing calls this directly
no test coverage detected