certmanager/templates/export_certificate.html
2025-06-14 08:47:23 +08:00

64 lines
2.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends "base.html" %}
{% block title %}导出证书 - {{ cert.common_name }}{% endblock %}
{% block content %}
<div class="card">
<div class="card-header">
<h4 class="card-title">导出证书: {{ cert.common_name }}</h4>
</div>
<div class="card-body">
<form method="POST" action="{{ url_for('export_certificate_view', cert_id=cert.id) }}">
<div class="mb-3">
<label class="form-label">导出格式</label>
<div class="form-check">
<input class="form-check-input" type="radio" name="format" id="formatPkcs12" value="pkcs12" checked>
<label class="form-check-label" for="formatPkcs12">
PKCS#12 (.p12/.pfx)
</label>
<div class="form-text">包含证书和私钥的加密存档,适用于大多数应用</div>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="format" id="formatPem" value="pem">
<label class="form-check-label" for="formatPem">
PEM (.pem)
</label>
<div class="form-text">Base64编码的证书和私钥适用于Nginx/Apache等</div>
</div>
</div>
<div class="mb-3" id="passwordField">
<label for="password" class="form-label">PKCS#12密码</label>
<input type="password" class="form-control" id="password" name="password">
<div class="form-text">用于保护PKCS#12文件的密码</div>
</div>
<div class="d-grid gap-2 d-md-flex justify-content-md-end">
<a href="{{ url_for('certificate_detail', cert_id=cert.id) }}" class="btn btn-secondary me-md-2">取消</a>
<button type="submit" class="btn btn-primary">导出证书</button>
</div>
</form>
</div>
</div>
{% block scripts %}
<script>
document.addEventListener('DOMContentLoaded', function() {
const formatRadios = document.querySelectorAll('input[name="format"]');
const passwordField = document.getElementById('passwordField');
function togglePasswordField() {
const selectedFormat = document.querySelector('input[name="format"]:checked').value;
passwordField.style.display = selectedFormat === 'pkcs12' ? 'block' : 'none';
}
formatRadios.forEach(radio => {
radio.addEventListener('change', togglePasswordField);
});
// 初始化状态
togglePasswordField();
});
</script>
{% endblock %}
{% endblock %}