实现对ACME用户的增删改
This commit is contained in:
@@ -4,20 +4,25 @@
|
||||
Vue.component("menu-item", {
|
||||
props: ["href", "active", "code"],
|
||||
data: function () {
|
||||
var active = this.active;
|
||||
if (typeof(active) =="undefined") {
|
||||
var itemCode = "";
|
||||
var active = this.active
|
||||
if (typeof (active) == "undefined") {
|
||||
var itemCode = ""
|
||||
if (typeof (window.TEA.ACTION.data.firstMenuItem) != "undefined") {
|
||||
itemCode = window.TEA.ACTION.data.firstMenuItem;
|
||||
itemCode = window.TEA.ACTION.data.firstMenuItem
|
||||
}
|
||||
active = (itemCode == this.code);
|
||||
active = (itemCode == this.code)
|
||||
}
|
||||
return {
|
||||
vHref: (this.href == null) ? "" : this.href,
|
||||
vActive: active
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
click: function (e) {
|
||||
this.$emit("click", e)
|
||||
}
|
||||
},
|
||||
template: '\
|
||||
<a :href="vHref" class="item" :class="{active:vActive}"><slot></slot></a> \
|
||||
<a :href="vHref" class="item" :class="{active:vActive}" @click="click"><slot></slot></a> \
|
||||
'
|
||||
});
|
||||
@@ -36,7 +36,7 @@ Vue.component("ssl-certs-box", {
|
||||
width = "35em"
|
||||
height = "20em"
|
||||
}
|
||||
teaweb.popup("/servers/components/ssl/selectPopup?viewSize=" + viewSize, {
|
||||
teaweb.popup("/servers/certs/selectPopup?viewSize=" + viewSize, {
|
||||
width: width,
|
||||
height: height,
|
||||
callback: function (resp) {
|
||||
@@ -48,7 +48,7 @@ Vue.component("ssl-certs-box", {
|
||||
// 上传证书
|
||||
uploadCert: function () {
|
||||
let that = this
|
||||
teaweb.popup("/servers/components/ssl/uploadPopup", {
|
||||
teaweb.popup("/servers/certs/uploadPopup", {
|
||||
height: "28em",
|
||||
callback: function (resp) {
|
||||
teaweb.success("上传成功", function () {
|
||||
|
||||
@@ -17,7 +17,7 @@ Vue.component("ssl-certs-view", {
|
||||
|
||||
// 查看详情
|
||||
viewCert: function (certId) {
|
||||
teaweb.popup("/servers/components/ssl/certPopup?certId=" + certId, {
|
||||
teaweb.popup("/servers/certs/certPopup?certId=" + certId, {
|
||||
height: "28em",
|
||||
width: "48em"
|
||||
})
|
||||
|
||||
@@ -95,7 +95,7 @@ Vue.component("ssl-config-box", {
|
||||
// 选择证书
|
||||
selectCert: function () {
|
||||
let that = this
|
||||
teaweb.popup("/servers/components/ssl/selectPopup", {
|
||||
teaweb.popup("/servers/certs/selectPopup", {
|
||||
width: "50em",
|
||||
height: "30em",
|
||||
callback: function (resp) {
|
||||
@@ -108,7 +108,7 @@ Vue.component("ssl-config-box", {
|
||||
// 上传证书
|
||||
uploadCert: function () {
|
||||
let that = this
|
||||
teaweb.popup("/servers/components/ssl/uploadPopup", {
|
||||
teaweb.popup("/servers/certs/uploadPopup", {
|
||||
height: "28em",
|
||||
callback: function (resp) {
|
||||
teaweb.success("上传成功", function () {
|
||||
@@ -277,7 +277,7 @@ Vue.component("ssl-config-box", {
|
||||
// 选择客户端CA证书
|
||||
selectClientCACert: function () {
|
||||
let that = this
|
||||
teaweb.popup("/servers/components/ssl/selectPopup?isCA=1", {
|
||||
teaweb.popup("/servers/certs/selectPopup?isCA=1", {
|
||||
width: "50em",
|
||||
height: "30em",
|
||||
callback: function (resp) {
|
||||
@@ -290,7 +290,7 @@ Vue.component("ssl-config-box", {
|
||||
// 上传CA证书
|
||||
uploadClientCACert: function () {
|
||||
let that = this
|
||||
teaweb.popup("/servers/components/ssl/uploadPopup?isCA=1", {
|
||||
teaweb.popup("/servers/certs/uploadPopup?isCA=1", {
|
||||
height: "28em",
|
||||
callback: function (resp) {
|
||||
teaweb.success("上传成功", function () {
|
||||
|
||||
@@ -62,6 +62,13 @@ Tea.context(function () {
|
||||
height: "24em"
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹窗中默认成功回调
|
||||
*/
|
||||
if (window.IS_POPUP === true) {
|
||||
this.success = window.NotifyPopup
|
||||
}
|
||||
});
|
||||
|
||||
window.NotifySuccess = function (message, url, params) {
|
||||
|
||||
@@ -17,19 +17,22 @@
|
||||
<script type="text/javascript" src="/js/sweetalert2/dist/sweetalert2.all.min.js"></script>
|
||||
<script type="text/javascript" src="/js/date.tea.js"></script>
|
||||
<style type="text/css">
|
||||
.main {
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
overflow-y: auto;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
.main {
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
overflow-y: auto;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.main::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
}
|
||||
.main::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.IS_POPUP = true
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,6 +1,4 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
|
||||
this.hasHTTPS = false
|
||||
this.changeListens = function (addrs) {
|
||||
this.hasHTTPS = addrs.$any(function (k, v) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
let addr = window.parent.UPDATING_ADDR
|
||||
this.protocol = addr.protocol
|
||||
this.addr = addr.host + ":" + addr.portRange
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function (){
|
||||
this.success = NotifyPopup;
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup;
|
||||
});
|
||||
4
web/views/@default/servers/certs/acme/@menu.html
Normal file
4
web/views/@default/servers/certs/acme/@menu.html
Normal 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>
|
||||
6
web/views/@default/servers/certs/acme/index.html
Normal file
6
web/views/@default/servers/certs/acme/index.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{$layout}
|
||||
{$template "/left_menu_top"}
|
||||
|
||||
<div class="right-box without-tabbar">
|
||||
{$template "menu"}
|
||||
</div>
|
||||
22
web/views/@default/servers/certs/acme/users/createPopup.html
Normal file
22
web/views/@default/servers/certs/acme/users/createPopup.html
Normal 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>
|
||||
36
web/views/@default/servers/certs/acme/users/index.html
Normal file
36
web/views/@default/servers/certs/acme/users/index.html
Normal 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>
|
||||
<a href="" @click.prevent="deleteUser(user.id)">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="page" v-html="page"></div>
|
||||
</div>
|
||||
32
web/views/@default/servers/certs/acme/users/index.js
Normal file
32
web/views/@default/servers/certs/acme/users/index.js
Normal 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()
|
||||
})
|
||||
}
|
||||
})
|
||||
23
web/views/@default/servers/certs/acme/users/updatePopup.html
Normal file
23
web/views/@default/servers/certs/acme/users/updatePopup.html
Normal 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>
|
||||
@@ -49,9 +49,9 @@
|
||||
<tr>
|
||||
<td>证书文件下载</td>
|
||||
<td>
|
||||
<a :href="'/servers/components/ssl/downloadZip?certId=' + info.id" target="_blank">[ZIP下载]</a>
|
||||
<a :href="'/servers/components/ssl/downloadCert?certId=' + info.id" target="_blank">[证书下载]</a>
|
||||
<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>
|
||||
<a :href="'/servers/certs/downloadCert?certId=' + info.id" target="_blank">[证书下载]</a>
|
||||
<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>
|
||||
@@ -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>
|
||||
@@ -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 () {
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -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}
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup;
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup;
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -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}
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
Reference in New Issue
Block a user