实现对ACME用户的增删改

This commit is contained in:
刘祥超
2020-11-24 17:36:42 +08:00
parent 169fe50a21
commit 3ba0d58cb8
84 changed files with 497 additions and 174 deletions

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup;
});

View File

@@ -0,0 +1,4 @@
<first-menu>
<menu-item href="/servers/certs/acme" code="cert">证书</menu-item>
<menu-item href="/servers/certs/acme/users" code="user">用户</menu-item>
</first-menu>

View File

@@ -0,0 +1,6 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "menu"}
</div>

View File

@@ -0,0 +1,22 @@
{$layout "layout_popup"}
<h3>创建用户</h3>
<form method="post" class="ui form" data-tea-success="success" data-tea-action="$">
<csrf-token></csrf-token>
<table class="ui table definition selectable">
<tr>
<td class="title">用户邮箱 *</td>
<td>
<input type="text" name="email" maxlength="100" ref="focus"/>
<p class="comment">用于自动注册用户的邮箱。</p>
</td>
</tr>
<tr>
<td>备注</td>
<td>
<textarea name="description" rows="3" maxlength="100"></textarea>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,36 @@
{$layout}
{$template "/left_menu_top"}
<div class="right-box without-tabbar">
{$template "../menu"}
<second-menu>
<menu-item @click.prevent="createUser">[创建用户]</menu-item>
<menu-item><tip-icon content="这里管理用于申请免费证书的用户信息"></tip-icon></menu-item>
</second-menu>
<p class="comment" v-if="users.length == 0">暂时还没有用户。</p>
<table class="ui table selectable" v-if="users.length > 0">
<thead>
<tr>
<th>Email</th>
<th>备注</th>
<th class="two op">操作</th>
</tr>
</thead>
<tr v-for="user in users">
<td>{{user.email}}</td>
<td>
<span v-if="user.description.length > 0">{{user.description}}</span>
<span v-else class="disabled">-</span>
</td>
<td>
<a href="" @click.prevent="updateUser(user.id)">修改</a> &nbsp;
<a href="" @click.prevent="deleteUser(user.id)">删除</a>
</td>
</tr>
</table>
<div class="page" v-html="page"></div>
</div>

View File

@@ -0,0 +1,32 @@
Tea.context(function () {
this.createUser = function () {
teaweb.popup(Tea.url(".createPopup"), {
callback: function () {
teaweb.success("创建成功", function () {
teaweb.reload()
})
}
})
}
this.updateUser = function (userId) {
teaweb.popup("/servers/certs/acme/users/updatePopup?userId=" + userId, {
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
this.deleteUser = function (userId) {
let that = this
teaweb.confirm("确定要删除此用户吗?", function () {
that.$post(".delete")
.params({
userId: userId
})
.refresh()
})
}
})

View File

@@ -0,0 +1,23 @@
{$layout "layout_popup"}
<h3>修改用户</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"/>
<table class="ui table definition selectable">
<tr>
<td class="title">用户邮箱 *</td>
<td>
{{user.email}}
<p class="comment">用于自动注册用户的邮箱,不允许修改。</p>
</td>
</tr>
<tr>
<td>备注</td>
<td>
<textarea name="description" rows="3" maxlength="100" v-model="user.description" ref="focus"></textarea>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -49,9 +49,9 @@
<tr>
<td>证书文件下载</td>
<td>
<a :href="'/servers/components/ssl/downloadZip?certId=' + info.id" target="_blank">[ZIP下载]</a> &nbsp;
<a :href="'/servers/components/ssl/downloadCert?certId=' + info.id" target="_blank">[证书下载]</a> &nbsp;
<a :href="'/servers/components/ssl/downloadKey?certId=' + info.id" v-if="!info.isCA" target="_blank">[私钥下载]</a>
<a :href="'/servers/certs/downloadZip?certId=' + info.id" target="_blank">[ZIP下载]</a> &nbsp;
<a :href="'/servers/certs/downloadCert?certId=' + info.id" target="_blank">[证书下载]</a> &nbsp;
<a :href="'/servers/certs/downloadKey?certId=' + info.id" v-if="!info.isCA" target="_blank">[私钥下载]</a>
</td>
</tr>
<tr>
@@ -59,7 +59,7 @@
<td>
<pre class="pre-box" style="font-family: Menlo, Monaco, 'Courier New', monospace !important">{{info.certString}}</pre>
<div style="margin-top:1em">
<a :href="'/servers/components/ssl/viewCert?certId=' + info.id" target="_blank">[浏览器新窗口打开]</a>
<a :href="'/servers/certs/viewCert?certId=' + info.id" target="_blank">[浏览器新窗口打开]</a>
</div>
</td>
</tr>
@@ -67,7 +67,7 @@
<td>私钥预览</td>
<td><pre class="pre-box" style="font-family: Menlo, Monaco, 'Courier New', monospace !important">{{info.keyString}}</pre>
<div style="margin-top: 1em">
<a :href="'/servers/components/ssl/viewKey?certId=' + info.id" target="_blank">[浏览器新窗口打开]</a>
<a :href="'/servers/certs/viewKey?certId=' + info.id" target="_blank">[浏览器新窗口打开]</a>
</div>
</td>
</tr>

View File

@@ -3,12 +3,12 @@
<div class="right-box without-tabbar">
<second-menu>
<menu-item href="/servers/components/ssl" :active="type == ''">所有证书({{countAll}})</menu-item>
<menu-item href="/servers/components/ssl?type=ca" :active="type == 'ca'">CA证书({{countCA}})</menu-item>
<menu-item href="/servers/components/ssl?type=available" :active="type == 'available'">有效证书({{countAvailable}})</menu-item>
<menu-item href="/servers/components/ssl?type=expired" :active="type == 'expired'">过期证书<span :class="{red: countExpired > 0}">({{countExpired}})</span></menu-item>
<menu-item href="/servers/components/ssl?type=7days" :active="type == '7days'">7天内过期<span :class="{red: count7Days > 0}">({{count7Days}})</span></menu-item>
<menu-item href="/servers/components/ssl?type=30days" :active="type == '30days'">30天过期({{count30Days}})</menu-item>
<menu-item href="/servers/certs" :active="type == ''">所有证书({{countAll}})</menu-item>
<menu-item href="/servers/certs?type=ca" :active="type == 'ca'">CA证书({{countCA}})</menu-item>
<menu-item href="/servers/certs?type=available" :active="type == 'available'">有效证书({{countAvailable}})</menu-item>
<menu-item href="/servers/certs?type=expired" :active="type == 'expired'">过期证书<span :class="{red: countExpired > 0}">({{countExpired}})</span></menu-item>
<menu-item href="/servers/certs?type=7days" :active="type == '7days'">7天内过期<span :class="{red: count7Days > 0}">({{count7Days}})</span></menu-item>
<menu-item href="/servers/certs?type=30days" :active="type == '30days'">30天过期({{count30Days}})</menu-item>
<span class="item">|</span>
<a href="" class="item" @click.prevent="uploadCert">[上传证书]</a>
</second-menu>

View File

@@ -1,7 +1,7 @@
Tea.context(function () {
// 上传证书
this.uploadCert = function () {
teaweb.popup("/servers/components/ssl/uploadPopup", {
teaweb.popup("/servers/certs/uploadPopup", {
height: "28em",
callback: function () {
teaweb.success("上传成功", function () {
@@ -15,7 +15,7 @@ Tea.context(function () {
this.deleteCert = function (certId) {
let that = this
teaweb.confirm("确定要删除此证书吗?", function () {
that.$post("/servers/components/ssl/delete")
that.$post("/servers/certs/delete")
.params({
certId: certId
})
@@ -25,7 +25,7 @@ Tea.context(function () {
// 查看证书
this.viewCert = function (certId) {
teaweb.popup("/servers/components/ssl/certPopup?certId=" + certId, {
teaweb.popup("/servers/certs/certPopup?certId=" + certId, {
height: "28em",
width: "48em"
})
@@ -33,7 +33,7 @@ Tea.context(function () {
// 修改证书
this.updateCert = function (certId) {
teaweb.popup("/servers/components/ssl/updatePopup?certId=" + certId, {
teaweb.popup("/servers/certs/updatePopup?certId=" + certId, {
height: "28em",
callback: function () {
teaweb.success("上传成功", function () {

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -2,7 +2,7 @@
{$template "/left_menu"}
{$var "header"}
<script src="/servers/components/ssl/datajs" type="text/javascript"></script>
<script src="/servers/certs/datajs" type="text/javascript"></script>
<script src="/js/sortable.min.js" type="text/javascript"></script>
{$end}

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup;
});

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup;
});

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -2,7 +2,7 @@
{$template "/left_menu"}
{$var "header"}
<script src="/servers/components/ssl/datajs" type="text/javascript"></script>
<script src="/servers/certs/datajs" type="text/javascript"></script>
<script src="/js/sortable.min.js" type="text/javascript"></script>
{$end}

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup
})