Projekt

Obecné

Profil

« Předchozí | Další » 

Revize a857e1ac

Přidáno uživatelem Jan Pašek před asi 4 roky(ů)

Re #8583 Added self-signed checkbox when creating certificates

Zobrazit rozdíly:

static/js/create_certificate.js
5 5
            data: {
6 6
                notBefore: "",
7 7
                notAfter: "",
8
                isSelfSigned: false,
8 9
                // available certificate authorities
9 10
                authorities: [],
10 11
                // data of the selected certificate authorities to be displayed in the form
......
50 51
                onCreateCertificate: function () {
51 52
                    // validate input data
52 53
                    // - validate if subject CN is filled in
54
                    if(!this.isSelfSigned && this.certificateData.CA == null)
55
                    {
56
                        alert("Issuer must be selected or 'Self-signed' option must be checked!");
57
                        return;
58
                    }
53 59
                    if(this.certificateData.subject.CN === "") {
54 60
                        alert("CN field must be filled in!"); // TODO highlight the field
55 61
                        return;
......
74 80
            },
75 81
            // data watches
76 82
            watch: {
83
                authorities: function (val, oldVal) {
84
                    this.isSelfSigned = val.length === 0;
85
                },
86
                isSelfSigned: function (val, oldVal) {
87
                    if (val) {
88
                        this.certificateData.CA = null;
89
                    }
90
                },
77 91
                // if the selected CA is changed, the Issuer input fileds must be filled in
78 92
                'certificateData.validityDays': function (val, oldVal) {
79 93
                    var endDate = new Date(new Date().getTime()+(val*24*60*60*1000));
......
123 137
                createCertificateApp.authorities = response.data["data"];
124 138
            }
125 139
            else
126
                console.log("Error occurred while fetching list of available certificate authorities");
140
            {
141
                createCertificateApp.authorities = []
142
            }
127 143
        })
128 144
        .catch(function (error) {
129 145
            console.log(error);

Také k dispozici: Unified diff