申请ACME证书时可以指定平台用户

This commit is contained in:
GoEdgeLab
2023-04-23 15:01:43 +08:00
parent 9c95dfcc24
commit d943ebf843
9 changed files with 123 additions and 46 deletions

View File

@@ -26,7 +26,7 @@
<div v-show="step == 'prepare'">
<table class="ui table definition selectable">
<tr>
<td class="title">认证方式</td>
<td class="title">认证方式 *</td>
<td>
<div style="margin-bottom: 1em">
<radio name="authType" :v-value="'http'" v-model="authType">使用HTTP认证</radio> &nbsp;
@@ -39,6 +39,13 @@
<p class="comment">我们在申请免费证书的过程中需要自动增加或修改相关域名的TXT记录请先确保你已经在"域名解析" -- <a href="/dns/providers" target="_blank">"DNS服务商"</a> 中已经添加了对应的DNS服务商账号。</p>
</div>
</td>
</tr>
<tr>
<td>选择平台用户</td>
<td>
<user-selector @change="changePlatformUser"></user-selector>
<p class="comment">可选项,选择证书所属用户,如果没有选择,则视为管理员所有。</p>
</td>
</tr>
<tr>
<td colspan="2">
@@ -74,7 +81,7 @@
</td>
</tr>
<tr v-if="providerCode.length > 0">
<td class="title">选择用户 *</td>
<td class="title">选择ACME用户 *</td>
<td>
<div v-if="users.length > 0">
<div class="ui fields inline">
@@ -89,7 +96,7 @@
</div>
</div>
</div>
<div v-else><a href="" @click.prevent="createUser">暂时还没有用户,点此创建</a></div>
<div v-else><a href="" @click.prevent="createUser"><span v-if="platformUserId > 0">当前平台用户下</span>暂时还没有ACME用户,点此创建</a></div>
<p class="comment">选择一个作为申请证书的用户。</p>
</td>
</tr>

View File

@@ -1,13 +1,31 @@
Tea.context(function () {
this.step = "prepare"
/**
* 选择平台用户
*/
this.platformUserId = 0
this.changePlatformUser = function (platformUserId) {
this.platformUserId = platformUserId
}
/**
* 准备工作
*/
this.authType = "http"
this.users = []
this.doPrepare = function () {
this.step = "user"
this.$post(".userOptions")
.params({
platformUserId: this.platformUserId
})
.success(function (resp) {
this.users = resp.data.users
})
}
this.prepareMoreOptionsVisible = false
@@ -17,7 +35,7 @@ Tea.context(function () {
}
/**
* 选择用户
* 选择ACME用户
*/
this.userId = 0
@@ -27,7 +45,7 @@ Tea.context(function () {
this.createUser = function () {
let that = this
teaweb.popup("/servers/certs/acme/users/createPopup?providerCode=" + this.providerCode, {
teaweb.popup("/servers/certs/acme/users/createPopup?providerCode=" + this.providerCode + "&platformUserId=" + this.platformUserId, {
height: "30em",
width: "44em",
callback: function (resp) {
@@ -90,6 +108,7 @@ Tea.context(function () {
this.$post("$")
.params({
platformUserId: this.platformUserId,
authType: this.authType,
acmeUserId: this.userId,
dnsProviderId: this.dnsProviderId,

View File

@@ -1,9 +1,14 @@
{$layout "layout_popup"}
<h3>创建用户</h3>
<h3>创建ACME用户</h3>
<form method="post" class="ui form" data-tea-success="success" data-tea-action="$">
<csrf-token></csrf-token>
<input type="hidden" name="platformUserId" :value="platformUserId"/>
<table class="ui table definition selectable">
<tr v-if="platformUser != null">
<td>所属平台用户</td>
<td><user-link :v-user="platformUser"></user-link></td>
</tr>
<tr>
<td class="title">用户邮箱 *</td>
<td>

View File

@@ -1,6 +1,6 @@
{$layout "layout_popup"}
<h3>修改用户</h3>
<h3>修改ACME用户</h3>
<form method="post" class="ui form" data-tea-success="success" data-tea-action="$">
<csrf-token></csrf-token>
<input type="hidden" name="userId" :value="user.id"/>