Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 0e7fa934

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

Re #8583 Certificate creation - display bootstrap alert instead of popup alert

Zobrazit rozdíly:

static/create_certificate.html
3 3
<head>
4 4
    <meta charset="UTF-8">
5 5
    <title>X.509 Certificate Management</title>
6
    <link rel="stylesheet" href="/static/css/app.css">
6 7
    <link rel="stylesheet" href="/static/css/bootstrap.min.css">
7 8
</head>
8 9
<body class="p-4">
9 10
    <div id="create-certificate-content" class="container">
10 11
        <h1 class="text-center">Create Certificate</h1>
12

  
13
        <div v-if="errorMessage !== ''" class="alert alert-danger" v-cloak role="alert">
14
            {{ errorMessage }}
15
        </div>
16

  
11 17
        <table class="ml-auto mr-auto">
12 18
            <tr>
13 19
                <div class="form-group">
static/css/app.css
1
[v-cloak] {
2
  display: none;
3
}
static/js/create_certificate.js
37 37
                        SSL: false
38 38
                    },
39 39
                    CA: null
40
                }
40
                },
41
                errorMessage: ""
41 42
            },
42 43
            // actions to be performed when the page is loaded
43 44
            // - initialize notBefore and notAfter with current date and current date + 1 month respectively
......
47 48
              this.notAfter = endDate.toDateInputValue(); // init notAfter to notBefore + 30 days
48 49
            },
49 50
            methods: {
51
                showError: function (message) {
52
                    document.body.scrollTop = 0;
53
                    document.documentElement.scrollTop = 0;
54
                    this.errorMessage = message;
55
                },
50 56
                // handle certificate creation request
51 57
                onCreateCertificate: function () {
52 58
                    // validate input data
53 59
                    // - validate if subject CN is filled in
54 60
                    if(!this.isSelfSigned && this.certificateData.CA == null)
55 61
                    {
56
                        alert("Issuer must be selected or 'Self-signed' option must be checked!");
62
                        this.showError("Issuer must be selected or 'Self-signed' option must be checked!")
57 63
                        return;
58 64
                    }
59 65
                    if(this.certificateData.subject.CN === "") {
60
                        alert("CN field must be filled in!"); // TODO highlight the field
66
                        this.showError("CN field must be filled in!") // TODO highlight the field
61 67
                        return;
62 68
                    }
63 69
                    this.certificateData.validityDays = parseInt(this.certificateData.validityDays);
......
87 93
                    if (val) {
88 94
                        this.certificateData.CA = null;
89 95
                        this.certificateData.usage.CA = true;
96
                    } else {
97
                        this.certificateData.usage.CA = false;
90 98
                    }
91 99
                },
92 100
                // if the selected CA is changed, the Issuer input fileds must be filled in

Také k dispozici: Unified diff