57
57
<NcTextField id =" commonName"
58
58
ref =" commonName"
59
59
v-model =" certificate.rootCert.commonName"
60
- :helper-text =" t('libresign', 'Full name of the main company or main user of this instance')"
61
- :minlength =" 1"
62
- :success =" certificate.rootCert.commonName !== ''"
63
- :error =" certificate.rootCert.commonName === ''"
60
+ :helper-text =" getRuleById('CN').helperText"
61
+ :minlength =" getRuleById('CN').min"
62
+ :maxlength =" getRuleById('CN').max"
63
+ :success =" !getRuleById('CN').required || certificate.rootCert.commonName !== ''"
64
+ :error =" getRuleById('CN').required && certificate.rootCert.commonName === ''"
64
65
:disabled =" formDisabled" />
65
66
</div >
66
67
<CertificateCustonOptions :names.sync =" certificate.rootCert.names" />
@@ -115,7 +116,6 @@ import NcTextField from '@nextcloud/vue/components/NcTextField'
115
116
import CertificateCustonOptions from ' ./CertificateCustonOptions.vue'
116
117
import CertificatePolicy from ' ./CertificatePolicy.vue'
117
118
118
- import { selectCustonOption } from ' ../../helpers/certification.js'
119
119
import logger from ' ../../logger.js'
120
120
import { useConfigureCheckStore } from ' ../../store/configureCheck.js'
121
121
@@ -139,6 +139,7 @@ export default {
139
139
const CPS = loadState (' libresign' , ' certificate_policies_cps' )
140
140
const rulesService = loadState (' libresign' , ' rules_service' )
141
141
return {
142
+ rulesService,
142
143
isThisEngine: loadState (' libresign' , ' certificate_engine' ) === ' openssl' ,
143
144
modal: false ,
144
145
certificate: {
@@ -200,9 +201,16 @@ export default {
200
201
this .certificate .rootCert .names = names
201
202
},
202
203
getLabelFromId (id ) {
203
- const item = selectCustonOption (id). unwrap ( )
204
- return item .label
204
+ const item = this . rulesService . find ( rule => rule . id === id )
205
+ return item ? item .label : id
205
206
},
207
+ getRuleById (id ) {
208
+ return this .rulesService .find (rule => rule .id === id) || {}
209
+ },
210
+ getLabelFromId (id ) {
211
+ const rule = this .getRuleById (id)
212
+ return rule .label || id
213
+ },
206
214
changeEngine (engine ) {
207
215
this .isThisEngine = engine === ' openssl'
208
216
this .loadRootCertificate ()
0 commit comments