1 |
a3b708c2
|
Jan Pašek
|
var createCertificateApp = new Vue({
|
2 |
|
|
el: "#create-certificate-content",
|
3 |
|
|
data: {
|
4 |
b556270c
|
Jan Pašek
|
authorities: [{id: 5, CN: "Test"}],
|
5 |
|
|
selectedCAData: {
|
6 |
a3b708c2
|
Jan Pašek
|
CN: "",
|
7 |
|
|
C: "",
|
8 |
|
|
L: "",
|
9 |
|
|
ST: "",
|
10 |
|
|
O: "",
|
11 |
|
|
OU: "",
|
12 |
|
|
emailAddress: ""
|
13 |
9cac7fd4
|
Jan Pašek
|
},
|
14 |
|
|
certificateData: {
|
15 |
|
|
subject: {
|
16 |
|
|
CN: "",
|
17 |
|
|
C: "",
|
18 |
|
|
L: "",
|
19 |
|
|
ST: "",
|
20 |
|
|
O: "",
|
21 |
|
|
OU: "",
|
22 |
|
|
emailAddress: ""
|
23 |
|
|
},
|
24 |
|
|
notBefore: "",
|
25 |
|
|
notAfter: "",
|
26 |
|
|
usage: {
|
27 |
|
|
CA: false,
|
28 |
|
|
authentication: false,
|
29 |
|
|
digitalSignature: false,
|
30 |
|
|
SSL: false
|
31 |
|
|
},
|
32 |
|
|
CA: null
|
33 |
a3b708c2
|
Jan Pašek
|
}
|
34 |
b556270c
|
Jan Pašek
|
},
|
35 |
9cac7fd4
|
Jan Pašek
|
mounted () {
|
36 |
|
|
this.certificateData.notBefore = new Date().toDateInputValue();
|
37 |
|
|
var endDate = new Date(new Date().getTime()+(30*24*60*60*1000));
|
38 |
|
|
this.certificateData.notAfter = endDate.toDateInputValue();
|
39 |
|
|
},
|
40 |
b556270c
|
Jan Pašek
|
watch: {
|
41 |
9cac7fd4
|
Jan Pašek
|
'certificateData.CA': function (val, oldVal) {
|
42 |
b556270c
|
Jan Pašek
|
if (val === "null" || val == null) {
|
43 |
|
|
createCertificateApp.selectedCAData = {
|
44 |
|
|
CN: "",
|
45 |
|
|
C: "",
|
46 |
|
|
L: "",
|
47 |
|
|
ST: "",
|
48 |
|
|
O: "",
|
49 |
|
|
OU: "",
|
50 |
|
|
emailAddress: ""
|
51 |
|
|
};
|
52 |
|
|
}
|
53 |
|
|
else {
|
54 |
|
|
axios.get(API_URL + "certificates/" + val + "/details")
|
55 |
|
|
.then(function (response) {
|
56 |
|
|
if (response.data["success"]) {
|
57 |
|
|
createCertificateApp.selectedCAData = response.data["data"]["subject"];
|
58 |
|
|
}
|
59 |
|
|
else
|
60 |
|
|
console.log("Error occurred while fetching CA details");
|
61 |
|
|
})
|
62 |
|
|
.catch(function (error) {
|
63 |
|
|
console.log(error);
|
64 |
|
|
});
|
65 |
|
|
}
|
66 |
|
|
}
|
67 |
|
|
}
|
68 |
|
|
});
|
69 |
|
|
|
70 |
|
|
axios.get(API_URL+"certificates", {
|
71 |
|
|
params: {
|
72 |
|
|
filtering: {
|
73 |
|
|
CA: true
|
74 |
|
|
}
|
75 |
|
|
}
|
76 |
|
|
})
|
77 |
|
|
.then(function (response) {
|
78 |
|
|
if (response.data["success"]) {
|
79 |
|
|
createCertificateApp.authorities = response.data["data"];
|
80 |
a3b708c2
|
Jan Pašek
|
}
|
81 |
b556270c
|
Jan Pašek
|
else
|
82 |
|
|
console.log("Error occurred while fetching list of available certificate authorities");
|
83 |
|
|
})
|
84 |
|
|
.catch(function (error) {
|
85 |
|
|
console.log(error);
|
86 |
a3b708c2
|
Jan Pašek
|
});
|