fix for digital sign - select only valid certificate for client org and only valid head person
This commit is contained in:
parent
ef76fa6d5f
commit
14a041a8aa
@ -29,6 +29,8 @@ export default class DigitalCertificates extends React.Component
|
||||
|
||||
async componentDidMount()
|
||||
{
|
||||
const { company, main, head_person } = this.props;
|
||||
//console.log({ company, main });
|
||||
//console.log("DC", "CDM");
|
||||
|
||||
const { CryptoPro } = await import('ruscryptojs');
|
||||
@ -52,15 +54,59 @@ export default class DigitalCertificates extends React.Component
|
||||
this.cryptopro.certificateInfo(certificate.id)
|
||||
.then((cert) =>
|
||||
{
|
||||
if(cert.Subject['INNLE'] !== undefined && cert.Subject['INNLE'] !== null && cert.Subject['INNLE'] !== "")
|
||||
//console.log({ cert });
|
||||
if(cert.IsValid)
|
||||
{
|
||||
if(cert.IsValid)
|
||||
if(cert.Subject['OGRNIP'] !== undefined && cert.Subject['OGRNIP'] !== null && cert.Subject['OGRNIP'] !== "")
|
||||
{
|
||||
callback(null, [ { id: certificate.id, fields: cert.Subject, valid_to_date: moment(cert.ValidToDate).format("DD.MM.YYYY") } ]);
|
||||
if(cert.Subject['INN'] !== undefined && cert.Subject['INN'] !== null && cert.Subject['INN'] !== "")
|
||||
{
|
||||
if(company.inn === cert.Subject['INN'])
|
||||
{
|
||||
callback(null, [ { id: certificate.id, fields: cert.Subject, valid_to_date: moment(cert.ValidToDate).format("DD.MM.YYYY") } ]);
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(null, []);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(null, []);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(null, []);
|
||||
if(cert.Subject['INNLE'] !== undefined && cert.Subject['INNLE'] !== null && cert.Subject['INNLE'] !== "")
|
||||
{
|
||||
let owner_valid = true;
|
||||
const fields = [ "lastname", "firstname", "middlename", ];
|
||||
const cert_owner = `${ cert.Subject['SN']} ${ cert.Subject['G']}`.toUpperCase();
|
||||
|
||||
for(let i in fields)
|
||||
{
|
||||
if(head_person[fields[i]] !== null && head_person[fields[i]] !== "")
|
||||
{
|
||||
if(cert_owner.indexOf(head_person[fields[i]].toUpperCase()) < 0)
|
||||
{
|
||||
owner_valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(owner_valid)
|
||||
{
|
||||
callback(null, [ { id: certificate.id, fields: cert.Subject, valid_to_date: moment(cert.ValidToDate).format("DD.MM.YYYY") } ]);
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(null, []);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(null, []);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -26,6 +26,7 @@ class Form_8_Signing extends QuestionnaireForm
|
||||
this.state = {
|
||||
loading: true,
|
||||
main: {},
|
||||
head_person: {},
|
||||
signatory_person: {},
|
||||
sign_digital: true,
|
||||
address: "",
|
||||
@ -45,6 +46,7 @@ class Form_8_Signing extends QuestionnaireForm
|
||||
main: nextProps.questionnaire.main,
|
||||
signatory_person: nextProps.questionnaire.signatory_person,
|
||||
sign: nextProps.questionnaire.sign,
|
||||
head_person: nextProps.questionnaire.head_person,
|
||||
company: nextProps.company,
|
||||
};
|
||||
}
|
||||
@ -59,7 +61,8 @@ class Form_8_Signing extends QuestionnaireForm
|
||||
//console.log("Form_8_Signing", "CDM", { state: this.state });
|
||||
|
||||
|
||||
const { main, signatory_person } = this.state;
|
||||
const { main, head_person, signatory_person } = this.state;
|
||||
|
||||
const update = { filename: `${ main.inn }_questionnaire_${ moment().format("DDMMYYYY_HHmmss") }.pdf` };
|
||||
let digital = true;
|
||||
|
||||
@ -142,7 +145,7 @@ class Form_8_Signing extends QuestionnaireForm
|
||||
|
||||
render()
|
||||
{
|
||||
const { loading, filename, sign_digital, sign, mobile, company, main, downloading, error, digital_disabled } = this.state;
|
||||
const { loading, filename, sign_digital, sign, head_person, mobile, company, main, downloading, error, digital_disabled } = this.state;
|
||||
|
||||
//console.log({ sign });
|
||||
|
||||
@ -202,7 +205,7 @@ class Form_8_Signing extends QuestionnaireForm
|
||||
</div>
|
||||
) : (
|
||||
<NoSSR>
|
||||
<DigitalCertificates main={ main } company={ company } onSignDigital={ this._handle_onSignDigital }/>
|
||||
<DigitalCertificates main={ main } company={ company } head_person={ head_person } onSignDigital={ this._handle_onSignDigital }/>
|
||||
</NoSSR>
|
||||
) }
|
||||
</>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user