• R/O
  • HTTP
  • SSH
  • HTTPS

e-dokyumento: Commit

e-Dokyumento is an opensource Document Management System that stores, organizes, indexes, routes, and tracks electronic documents. It automates the basic office document workflow such as receiving, filing, routing, and approving of hard-printed documents through capturing (scanning), digitizing (OCR Reading), storing, tagging, and electronically routing and approving (e-signature) of documents.


Commit MetaInfo

Revision1321f24fb7813a4d74eddd781a12f4c4282c124b (tree)
Time2020-10-25 14:25:42
AuthorNelson Maligro <nelsonmaligro@gmai...>
CommiterNelson Maligro

Log Message

25 Oct 2020

Change Summary

Incremental Difference

--- a/controllers/dasincoming.js
+++ b/controllers/dasincoming.js
@@ -416,7 +416,7 @@ module.exports = function(app, arrDB) {
416416 });
417417 } else {
418418 if (!fs.existsSync(drivetmp + user.group)) fs.mkdirSync(drivetmp + user.group);
419- fs.readdir(drivetmp + user.group, function(err,items){
419+ fs.readdir(drivetmp + user.group, function(err,items) {
420420 let sortArr = utilsdocms.checkPermission(items, drivetmp + user.group + '/');
421421 if (err) console.log(err);var def="empty";
422422 if (sortArr.length > 0) {def=sortArr[0];} var disDrive = '/drive/';var disFile = def;
--- a/controllers/dasroyalty.js
+++ b/controllers/dasroyalty.js
@@ -93,7 +93,9 @@ module.exports = function(app, arrDB){
9393 dochandle.convDoctoPDF(drivetmp+'PDF-temp/'+req.body.fileroute+'.'+req.body.user+'.pdf', drivetmp+'PDF-temp/'+req.body.fileroute+'.'+req.body.user+'.pdf' + '.sign.pdf', function(){
9494 let pdfBuffer = fs.readFileSync(drivetmp+'PDF-temp/'+req.body.fileroute+'.'+req.body.user+'.pdf' + '.sign.pdf');
9595 pdfBuffer = plainAddPlaceholder({ pdfBuffer, reason: 'I approved and signed this document.', signatureLength: 1612,});
96- let buf64 = Buffer.from(req.body.crtx, 'base64')
96+ //let buf64 = Buffer.from(req.body.crtx, 'base64')
97+ let buf64 = fs.readFileSync(drive+user.group+'/Signature/' + id +'.cert.psk',"utf8");
98+ buf64 = Buffer.from(buf64, 'base64');
9799 try {
98100 pdfBuffer = signer.sign(pdfBuffer, p12Buffer, {passphrase:buf64.toString("utf8")},);
99101 fs.writeFileSync(drivetmp+'PDF-temp/'+req.body.fileroute+'.'+req.body.user+'.pdf'+'.new.sign.pdf', pdfBuffer);
--- a/controllers/dassysadmin.js
+++ b/controllers/dassysadmin.js
@@ -225,6 +225,7 @@ module.exports = function(app, arrDB){
225225 if (!fs.existsSync(drive+user.group+'/Signature/')) fs.mkdirSync(drive+user.group+'/Signature');
226226 fs.copyFileSync(drivetmp +'Uploads/' + req.cookies.fileAI, drive+user.group+'/Signature/' + id +'.cert.p12')
227227 fs.unlinkSync(drivetmp +'Uploads/' + req.cookies.fileAI);
228+ fs.writeFileSync(drive+user.group+'/Signature/' + id +'.cert.psk',req.cookies.passCert);
228229 res.json('successful');
229230 dbhandle.actlogsCreate(id, Date.now(), 'User upload Digital Certificate for signature', 'none', req.ip);
230231 });
--- a/controllers/dastransact.js
+++ b/controllers/dastransact.js
@@ -187,7 +187,10 @@ module.exports = function(app, arrDB){
187187 dochandle.convDoctoPDF(drivetmp+'PDF-temp/' + disNewFile, drivetmp+'PDF-temp/' + disNewFile + '.sign.pdf', function(){
188188 let pdfBuffer = fs.readFileSync(drivetmp+'PDF-temp/' + disNewFile + '.sign.pdf');
189189 pdfBuffer = plainAddPlaceholder({ pdfBuffer, reason: 'I approved and signed this document.', signatureLength: 1612,});
190- let buf64 = Buffer.from(req.body.crtx, 'base64')
190+ //let buf64 = Buffer.from(req.body.crtx, 'base64')
191+ let buf64 = fs.readFileSync(drive+user.group+'/Signature/' + id +'.cert.psk',"utf8");
192+ buf64 = Buffer.from(buf64, 'base64');
193+ console.log(buf64.toString("utf8"));
191194 try {
192195 pdfBuffer = signer.sign(pdfBuffer, p12Buffer, {passphrase:buf64.toString("utf8")},);
193196 fs.writeFileSync(drivetmp+'PDF-temp/' + disNewFile + '.new.sign.pdf',pdfBuffer);
@@ -262,14 +265,15 @@ module.exports = function(app, arrDB){
262265 dochandle.convDoctoPDF(drivetmp+'PDF-temp/' + disNewFile, drivetmp+'PDF-temp/' + disNewFile + '.sign.pdf', function(){
263266 let pdfBuffer = fs.readFileSync(drivetmp+'PDF-temp/' + disNewFile + '.sign.pdf');
264267 pdfBuffer = plainAddPlaceholder({ pdfBuffer, reason: 'I approved and signed this document.', signatureLength: 1612,});
265- let buf64 = Buffer.from(req.body.crtx, 'base64')
268+ //let buf64 = Buffer.from(req.body.crtx, 'base64');
269+ let buf64 = fs.readFileSync(drive+user.group+'/Signature/' + id +'.cert.psk',"utf8");
270+ buf64 = Buffer.from(buf64, 'base64');
266271 try {
267272 pdfBuffer = signer.sign(pdfBuffer, p12Buffer, {passphrase:buf64.toString("utf8")},);
268273 fs.writeFileSync(drivetmp+'PDF-temp/' + disNewFile + '.new.sign.pdf',pdfBuffer);
269274 fs.copyFileSync(drivetmp+'PDF-temp/' + disNewFile + '.new.sign.pdf', req.body.realpath + disNewFile); //make a copy to drive folder
270275 resolve();
271276 } catch {resolve();}
272-
273277 });
274278 } else {
275279 fs.copyFileSync(drivetmp+'PDF-temp/' + disNewFile, req.body.realpath + disNewFile); //make a copy to drive folder
--- a/public/assets/app.js
+++ b/public/assets/app.js
@@ -27,7 +27,7 @@ function brsubmitQRPass(content){
2727 var realpath = getCookie('realpath');
2828 var user = getCookie('me');
2929 //let buffCont = new Buffer(content);
30- var todo = {hashval:hash, filepath:$('#disPath').val(), crtx:window.btoa(content), realpath:realpath, num:parseInt($('#selPageSign').val(),10)-1,fileroute: fileroute.val(), user:user};
30+ var todo = {hashval:hash, filepath:$('#disPath').val(), realpath:realpath, num:parseInt($('#selPageSign').val(),10)-1,fileroute: fileroute.val(), user:user};
3131 if (fileroute.val()!='empty'){
3232 $.ajax({
3333 type: 'POST',
--- a/public/assets/myprofile.js
+++ b/public/assets/myprofile.js
@@ -100,8 +100,8 @@ $(document).ready(function(){
100100 //handle button Certificate upload clicked
101101 $('#butUploadCert').on('click', function(e){
102102 let files = $('#certinput').val().split('\\'); let filename = files[files.length-1];
103- $('#overlay').show();
104- let upFiles = new FormData();setCookie('fileAI',filename,1);
103+ $('#overlay').show();let passHash = window.btoa($('#passCert').val().trim());
104+ let upFiles = new FormData();setCookie('fileAI',filename,1);setCookie('passCert',passHash,1);
105105 upFiles.append('certinput',$('#certinput')[0].files[0]);
106106 $.ajax({
107107 type: 'POST',
--- a/public/assets/routeroyal.js
+++ b/public/assets/routeroyal.js
@@ -116,7 +116,7 @@ function releasethisdoc(){
116116 if (($('#disLevel').val().toUpperCase()=="DEP") || ($('#disLevel').val().toUpperCase()=="EAGM")) distime = 5000;
117117 sleep(distime).then(()=>{
118118 var arrComm = getCookie('arrComm');
119- var todo = {comments:arrComm, crtx:window.btoa(disPass), hashval:lastQRCode, filepath:$('#disPath').val(), num:parseInt($('#selPage').val(),10)-1,fileroute: fileroute.val(), branch:releaseTo, user:user};
119+ var todo = {comments:arrComm, hashval:lastQRCode, filepath:$('#disPath').val(), num:parseInt($('#selPage').val(),10)-1,fileroute: fileroute.val(), branch:releaseTo, user:user};
120120 if (fileroute.val()!='empty'){
121121 $.ajax({
122122 type: 'POST',
@@ -138,7 +138,7 @@ function releasethisdoc(){
138138 var realpath = getCookie('realpath');
139139 var user = getCookie('me');
140140 let branch
141- var todo = {hashval:lastQRCode, crtx:window.btoa(disPass), filepath:$('#disPath').val(), origenc:getCookie('origEncFile'), origfile: $('#fileroute').val(), realpath:realpath, num:parseInt($('#selPage').val(),10)-1, user:user};
141+ var todo = {hashval:lastQRCode, filepath:$('#disPath').val(), origenc:getCookie('origEncFile'), origfile: $('#fileroute').val(), realpath:realpath, num:parseInt($('#selPage').val(),10)-1, user:user};
142142 $.ajax({
143143 type: 'POST',
144144 url: '/mergesigndocenc',
Binary files a/public/drive/PDF-temp/nelson.pdf and /dev/null differ
Binary files a/public/drive/PDF-temp/route-Administrator Guide.pdf.pdf and /dev/null differ
--- a/views/myprofile.ejs
+++ b/views/myprofile.ejs
@@ -95,7 +95,7 @@
9595 <div class="corner-ribon black-ribon"><i class="fa fa-certificate"></i></div>
9696 <div class="fa fa-twitter wtt-mark"></div>
9797
98- <div class="col col-md-5">
98+ <div class="col col-md-10">
9999 <div class="card">
100100 <div class="card-header bg-secondary">
101101 <strong class="card-title text-light">Upload Digital Certificate (PEM Format)</strong>
@@ -103,8 +103,14 @@
103103 <div class="card-body text-white bg-primary">
104104 <div class="row form-group">
105105 <form id="uploadCert" enctype="multipart/form-data" method="post" >
106- <div class="col col-md-12"><input type="file" id="certinput" name="certinput" class="form-control-file"></div>
107- <div class="col col-md-6 ml-auto">
106+ <div class="col col-md-4">
107+ <input type="file" id="certinput" name="certinput" class="form-control-file">
108+ </div>
109+ <div class="col col-md-2" style="left:40px;"> Password </div>
110+ <div class="col col-md-4">
111+ <input type='password' id='passCert' style='width:270px;'>
112+ </div>
113+ <div class="row col-md-3 ml-auto">
108114 <br>
109115 <button id="butUploadCert"type="submit" class="btn btn-warning btn-md "><i class="fa fa-cloud-upload"></i>&nbsp; Upload Certificate</button>
110116 </div>
Show on old repository browser