From cd5697ca7446ba8abfc407a602a178bf19525767 Mon Sep 17 00:00:00 2001 From: "kilian (ksmachome)" Date: Sun, 10 Nov 2019 21:10:25 +0100 Subject: [PATCH] v20191110 Admin --- CGI/api/db.cgi | 13 +- CGI/api/fingerprint.cgi | 136 +- CGI/api/index.cgi | 153 + CGI/api/lib/dksconfig.pm | 16 +- CGI/api/lib/sendemail.pm | 130 - CGI/api/tools/fingerenroll.py | 45 +- CGI/api/tools/fingersearch.py | 8 +- CGI/index.cgi | 2 +- CGI/tmpl/app/hourtrax/index.tt | 14 +- CGI/tmpl/app/hourtrax/module/members/index.js | 35 +- CGI/tmpl/app/hourtrax/module/members/index.tt | 24 +- .../app/hourtrax/module/timetrack/index.js | 63 +- .../app/hourtrax/module/timetrack/index.tt | 6 +- .../module/timetrack/usertimetrack.js | 136 + .../module/timetrack/usertimetrack.tt | 56 + .../settings => system/hourtrax}/index.js | 0 CGI/tmpl/app/system/hourtrax/index.tt | 0 CGI/tmpl/app/system/index.tt | 59 + CGI/tmpl/app/system/network/index.js | 0 .../settings => system/network}/index.tt | 8 +- CGI/tmpl/app/system/vpn/index.js | 0 CGI/tmpl/app/system/vpn/index.tt | 0 CGI/tmpl/app/timeclock/index.js | 74 +- CGI/tmpl/app/timeclock/index.tt | 29 +- CGI/tmpl/macro/fields.tt | 7 + CGI/tmpl/skeleton/index.tt | 3 +- CGI/tmpl/skeleton/module.tt | 3 + data/{hourtrax.passwd => auth.clear.passwd} | 0 data/auth.passwd | 1 + data/hourtrax.2.sqlite | Bin 0 -> 13312 bytes data/hourtrax.json | 1 - .../hourtrax.sqlite => hourtrax.old.sqlite} | Bin data/hourtrax.pid | 1 - data/hourtrax.sqlite | Bin 13312 -> 13312 bytes data/test/hourtrax.json | 1 - data/test/hourtrax.passwd | 1 - hourtrax.pl | 11 +- htdocs/img/fingerprint/finger1.svg | 80 + htdocs/img/fingerprint/finger2.svg | 82 + htdocs/img/fingerprint/finger3.svg | 80 + htdocs/img/fingerprint/finger4.svg | 78 + htdocs/img/fingerprint/finger5.svg | 79 + htdocs/img/fingerprint/fingerprint-check.svg | 86 + .../img/fingerprint/fingerprint-crosshair.svg | 91 + htdocs/img/fingerprint/fingerprint-remove.svg | 86 + .../fingerprint/fingerprint-remove_white.svg | 86 + .../fingerprint-scanning-index.svg | 109 + .../img/fingerprint/fingerprint-scanning.svg | 90 + htdocs/img/fingerprint/fingerprint-search.svg | 203 + htdocs/img/fingerprint/fingerprint-simple.svg | 87 + htdocs/img/icons/group.svg | 3 + htdocs/img/icons/group_white.svg | 3 + htdocs/img/icons/history.svg | 15 + htdocs/img/icons/history_white.svg | 15 + htdocs/js/admin.js | 42 +- htdocs/js/formsave.js | 7 +- htdocs/js/moduleglobal.js | 4 +- htdocs/js/request.js | 36 +- htdocs/vendor/jspdf/jspdf.min.js | 286 + htdocs/vendor/jspdf/jspdf.plugin.autotable.js | 1941 + .../jspdf/jspdf.plugin.autotable.min.js | 17 + htdocs/vendor/jsxlsx/LICENSE | 201 + htdocs/vendor/jsxlsx/cpexcel.js | 1505 + htdocs/vendor/jsxlsx/jszip.js | 8999 +++++ htdocs/vendor/jsxlsx/shim.min.js | 2 + htdocs/vendor/jsxlsx/xlsx.core.min.js | 17 + htdocs/vendor/jsxlsx/xlsx.core.min.map | 1 + htdocs/vendor/jsxlsx/xlsx.extendscript.js | 30131 ++++++++++++++++ htdocs/vendor/jsxlsx/xlsx.full.min.js | 23 + htdocs/vendor/jsxlsx/xlsx.full.min.map | 1 + htdocs/vendor/jsxlsx/xlsx.js | 20975 +++++++++++ htdocs/vendor/jsxlsx/xlsx.min.js | 14 + htdocs/vendor/jsxlsx/xlsx.min.map | 1 + htdocs/vendor/tinymce/LICENSE.TXT | 504 + htdocs/vendor/tinymce/changelog.txt | 951 + .../tinymce/js/tinymce/jquery.tinymce.min.js | 1 + htdocs/vendor/tinymce/js/tinymce/langs/de.js | 260 + .../vendor/tinymce/js/tinymce/langs/fr_FR.js | 261 + .../vendor/tinymce/js/tinymce/langs/readme.md | 3 + htdocs/vendor/tinymce/js/tinymce/license.txt | 504 + .../js/tinymce/plugins/advlist/plugin.min.js | 1 + .../js/tinymce/plugins/anchor/plugin.min.js | 1 + .../js/tinymce/plugins/autolink/plugin.min.js | 1 + .../tinymce/plugins/autoresize/plugin.min.js | 1 + .../js/tinymce/plugins/autosave/plugin.min.js | 1 + .../js/tinymce/plugins/bbcode/plugin.min.js | 1 + .../js/tinymce/plugins/charmap/plugin.min.js | 1 + .../js/tinymce/plugins/code/plugin.min.js | 1 + .../tinymce/plugins/codesample/css/prism.css | 138 + .../tinymce/plugins/codesample/plugin.min.js | 1 + .../tinymce/plugins/colorpicker/plugin.min.js | 1 + .../tinymce/plugins/contextmenu/plugin.min.js | 1 + .../plugins/directionality/plugin.min.js | 1 + .../plugins/emoticons/img/smiley-cool.gif | Bin 0 -> 354 bytes .../plugins/emoticons/img/smiley-cry.gif | Bin 0 -> 329 bytes .../emoticons/img/smiley-embarassed.gif | Bin 0 -> 331 bytes .../emoticons/img/smiley-foot-in-mouth.gif | Bin 0 -> 342 bytes .../plugins/emoticons/img/smiley-frown.gif | Bin 0 -> 340 bytes .../plugins/emoticons/img/smiley-innocent.gif | Bin 0 -> 336 bytes .../plugins/emoticons/img/smiley-kiss.gif | Bin 0 -> 338 bytes .../plugins/emoticons/img/smiley-laughing.gif | Bin 0 -> 343 bytes .../emoticons/img/smiley-money-mouth.gif | Bin 0 -> 321 bytes .../plugins/emoticons/img/smiley-sealed.gif | Bin 0 -> 323 bytes .../plugins/emoticons/img/smiley-smile.gif | Bin 0 -> 344 bytes .../emoticons/img/smiley-surprised.gif | Bin 0 -> 338 bytes .../emoticons/img/smiley-tongue-out.gif | Bin 0 -> 328 bytes .../emoticons/img/smiley-undecided.gif | Bin 0 -> 337 bytes .../plugins/emoticons/img/smiley-wink.gif | Bin 0 -> 350 bytes .../plugins/emoticons/img/smiley-yell.gif | Bin 0 -> 336 bytes .../tinymce/plugins/emoticons/plugin.min.js | 1 + .../js/tinymce/plugins/fullpage/plugin.min.js | 1 + .../tinymce/plugins/fullscreen/plugin.min.js | 1 + .../js/tinymce/plugins/help/img/logo.png | Bin 0 -> 13208 bytes .../js/tinymce/plugins/help/plugin.min.js | 1 + .../js/tinymce/plugins/hr/plugin.min.js | 1 + .../js/tinymce/plugins/image/plugin.min.js | 1 + .../tinymce/plugins/imagetools/plugin.min.js | 1 + .../tinymce/plugins/importcss/plugin.min.js | 1 + .../plugins/insertdatetime/plugin.min.js | 1 + .../plugins/legacyoutput/plugin.min.js | 1 + .../js/tinymce/plugins/link/plugin.min.js | 1 + .../js/tinymce/plugins/lists/plugin.min.js | 1 + .../js/tinymce/plugins/media/plugin.min.js | 1 + .../tinymce/plugins/nonbreaking/plugin.min.js | 1 + .../tinymce/plugins/noneditable/plugin.min.js | 1 + .../tinymce/plugins/pagebreak/plugin.min.js | 1 + .../js/tinymce/plugins/paste/plugin.min.js | 1 + .../js/tinymce/plugins/preview/plugin.min.js | 1 + .../js/tinymce/plugins/print/plugin.min.js | 1 + .../js/tinymce/plugins/save/plugin.min.js | 1 + .../plugins/searchreplace/plugin.min.js | 1 + .../plugins/spellchecker/plugin.min.js | 1 + .../js/tinymce/plugins/tabfocus/plugin.min.js | 1 + .../js/tinymce/plugins/table/plugin.min.js | 1 + .../js/tinymce/plugins/template/plugin.min.js | 1 + .../tinymce/plugins/textcolor/plugin.min.js | 1 + .../tinymce/plugins/textpattern/plugin.min.js | 1 + .../js/tinymce/plugins/toc/plugin.min.js | 1 + .../plugins/visualblocks/css/visualblocks.css | 154 + .../plugins/visualblocks/plugin.min.js | 1 + .../tinymce/plugins/visualchars/plugin.min.js | 1 + .../tinymce/plugins/wordcount/plugin.min.js | 1 + .../skins/lightgray/content.inline.min.css | 1 + .../tinymce/skins/lightgray/content.min.css | 1 + .../skins/lightgray/content.mobile.min.css | 1 + .../skins/lightgray/fonts/tinymce-mobile.woff | Bin 0 -> 4624 bytes .../skins/lightgray/fonts/tinymce-small.eot | Bin 0 -> 9492 bytes .../skins/lightgray/fonts/tinymce-small.svg | 63 + .../skins/lightgray/fonts/tinymce-small.ttf | Bin 0 -> 9304 bytes .../skins/lightgray/fonts/tinymce-small.woff | Bin 0 -> 9380 bytes .../tinymce/skins/lightgray/fonts/tinymce.eot | Bin 0 -> 18808 bytes .../tinymce/skins/lightgray/fonts/tinymce.svg | 131 + .../tinymce/skins/lightgray/fonts/tinymce.ttf | Bin 0 -> 18644 bytes .../skins/lightgray/fonts/tinymce.woff | Bin 0 -> 18720 bytes .../js/tinymce/skins/lightgray/img/anchor.gif | Bin 0 -> 53 bytes .../js/tinymce/skins/lightgray/img/loader.gif | Bin 0 -> 2608 bytes .../js/tinymce/skins/lightgray/img/object.gif | Bin 0 -> 152 bytes .../js/tinymce/skins/lightgray/img/trans.gif | Bin 0 -> 43 bytes .../js/tinymce/skins/lightgray/skin.min.css | 1 + .../skins/lightgray/skin.mobile.min.css | 2 + .../js/tinymce/themes/inlite/theme.min.js | 1 + .../js/tinymce/themes/mobile/theme.min.js | 1 + .../js/tinymce/themes/modern/theme.min.js | 1 + .../vendor/tinymce/js/tinymce/tinymce.min.js | 2 + 164 files changed, 69159 insertions(+), 377 deletions(-) create mode 100644 CGI/api/index.cgi delete mode 100755 CGI/api/lib/sendemail.pm create mode 100644 CGI/tmpl/app/hourtrax/module/timetrack/usertimetrack.js create mode 100644 CGI/tmpl/app/hourtrax/module/timetrack/usertimetrack.tt rename CGI/tmpl/app/{hourtrax/module/settings => system/hourtrax}/index.js (100%) create mode 100644 CGI/tmpl/app/system/hourtrax/index.tt create mode 100755 CGI/tmpl/app/system/index.tt create mode 100644 CGI/tmpl/app/system/network/index.js rename CGI/tmpl/app/{hourtrax/module/settings => system/network}/index.tt (93%) create mode 100644 CGI/tmpl/app/system/vpn/index.js create mode 100644 CGI/tmpl/app/system/vpn/index.tt rename data/{hourtrax.passwd => auth.clear.passwd} (100%) create mode 100644 data/auth.passwd create mode 100644 data/hourtrax.2.sqlite delete mode 100644 data/hourtrax.json rename data/{test/hourtrax.sqlite => hourtrax.old.sqlite} (100%) delete mode 100644 data/hourtrax.pid delete mode 100644 data/test/hourtrax.json delete mode 100644 data/test/hourtrax.passwd create mode 100644 htdocs/img/fingerprint/finger1.svg create mode 100644 htdocs/img/fingerprint/finger2.svg create mode 100644 htdocs/img/fingerprint/finger3.svg create mode 100644 htdocs/img/fingerprint/finger4.svg create mode 100644 htdocs/img/fingerprint/finger5.svg create mode 100644 htdocs/img/fingerprint/fingerprint-check.svg create mode 100644 htdocs/img/fingerprint/fingerprint-crosshair.svg create mode 100644 htdocs/img/fingerprint/fingerprint-remove.svg create mode 100644 htdocs/img/fingerprint/fingerprint-remove_white.svg create mode 100644 htdocs/img/fingerprint/fingerprint-scanning-index.svg create mode 100644 htdocs/img/fingerprint/fingerprint-scanning.svg create mode 100644 htdocs/img/fingerprint/fingerprint-search.svg create mode 100644 htdocs/img/fingerprint/fingerprint-simple.svg create mode 100755 htdocs/img/icons/group.svg create mode 100755 htdocs/img/icons/group_white.svg create mode 100644 htdocs/img/icons/history.svg create mode 100644 htdocs/img/icons/history_white.svg create mode 100644 htdocs/vendor/jspdf/jspdf.min.js create mode 100644 htdocs/vendor/jspdf/jspdf.plugin.autotable.js create mode 100644 htdocs/vendor/jspdf/jspdf.plugin.autotable.min.js create mode 100644 htdocs/vendor/jsxlsx/LICENSE create mode 100644 htdocs/vendor/jsxlsx/cpexcel.js create mode 100644 htdocs/vendor/jsxlsx/jszip.js create mode 100644 htdocs/vendor/jsxlsx/shim.min.js create mode 100644 htdocs/vendor/jsxlsx/xlsx.core.min.js create mode 100644 htdocs/vendor/jsxlsx/xlsx.core.min.map create mode 100644 htdocs/vendor/jsxlsx/xlsx.extendscript.js create mode 100644 htdocs/vendor/jsxlsx/xlsx.full.min.js create mode 100644 htdocs/vendor/jsxlsx/xlsx.full.min.map create mode 100644 htdocs/vendor/jsxlsx/xlsx.js create mode 100644 htdocs/vendor/jsxlsx/xlsx.min.js create mode 100644 htdocs/vendor/jsxlsx/xlsx.min.map create mode 100644 htdocs/vendor/tinymce/LICENSE.TXT create mode 100644 htdocs/vendor/tinymce/changelog.txt create mode 100644 htdocs/vendor/tinymce/js/tinymce/jquery.tinymce.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/langs/de.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/langs/fr_FR.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/langs/readme.md create mode 100644 htdocs/vendor/tinymce/js/tinymce/license.txt create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/advlist/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/anchor/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/autolink/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/autoresize/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/autosave/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/bbcode/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/charmap/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/code/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/codesample/css/prism.css create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/codesample/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/colorpicker/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/contextmenu/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/directionality/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/emoticons/img/smiley-cool.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/emoticons/img/smiley-cry.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/emoticons/img/smiley-embarassed.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/emoticons/img/smiley-frown.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/emoticons/img/smiley-innocent.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/emoticons/img/smiley-kiss.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/emoticons/img/smiley-laughing.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/emoticons/img/smiley-money-mouth.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/emoticons/img/smiley-sealed.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/emoticons/img/smiley-smile.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/emoticons/img/smiley-surprised.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/emoticons/img/smiley-tongue-out.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/emoticons/img/smiley-undecided.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/emoticons/img/smiley-wink.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/emoticons/img/smiley-yell.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/emoticons/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/fullpage/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/fullscreen/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/help/img/logo.png create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/help/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/hr/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/image/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/imagetools/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/importcss/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/insertdatetime/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/legacyoutput/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/link/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/lists/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/media/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/nonbreaking/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/noneditable/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/pagebreak/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/paste/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/preview/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/print/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/save/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/searchreplace/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/spellchecker/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/tabfocus/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/table/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/template/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/textcolor/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/textpattern/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/toc/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/visualblocks/css/visualblocks.css create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/visualblocks/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/visualchars/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/plugins/wordcount/plugin.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/content.inline.min.css create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/content.min.css create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/content.mobile.min.css create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/fonts/tinymce-mobile.woff create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/fonts/tinymce-small.eot create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/fonts/tinymce-small.svg create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/fonts/tinymce-small.ttf create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/fonts/tinymce-small.woff create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/fonts/tinymce.eot create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/fonts/tinymce.svg create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/fonts/tinymce.ttf create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/fonts/tinymce.woff create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/img/anchor.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/img/loader.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/img/object.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/img/trans.gif create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/skin.min.css create mode 100644 htdocs/vendor/tinymce/js/tinymce/skins/lightgray/skin.mobile.min.css create mode 100644 htdocs/vendor/tinymce/js/tinymce/themes/inlite/theme.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/themes/mobile/theme.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/themes/modern/theme.min.js create mode 100644 htdocs/vendor/tinymce/js/tinymce/tinymce.min.js diff --git a/CGI/api/db.cgi b/CGI/api/db.cgi index 3a6a3e9..534fa1b 100755 --- a/CGI/api/db.cgi +++ b/CGI/api/db.cgi @@ -10,7 +10,7 @@ use CGI::Cookie; # use CGI::Carp qw/fatalsToBrowser/; use File::Basename; use JSON::PP; -use UUID::Tiny ':std'; +#use UUID::Tiny ':std'; use dksconfig qw/$sitecfg/; use dksdb; @@ -24,9 +24,7 @@ foreach my $pe (@params){ $p->{$pe} = $cgi->param($pe); } my $html->{result} = (); -# $p->{sid} = $cgi->cookie($sitecfg->{cookiename}); -# my $se = session->new(); -# my $sess = $se->getsession($p->{sid}); + print $cgi->header(-type=>"application/json", -charset => "utf-8"); my $dbredirect = {}; if ($sitecfg->{dbtype} eq "SQLite"){ @@ -67,12 +65,7 @@ if (($cgi->request_method() eq "GET") || ($cgi->request_method() eq "POST")){ if ($x =~ /^ident_/ ){ if ($p->{$x} ne ""){ $type = "upd"; - } else { - my $uuid = create_uuid(UUID_TIME); - my $uuid_str=uuid_to_string($uuid); - $p->{$x} = $uuid_str; - } - + } } } diff --git a/CGI/api/fingerprint.cgi b/CGI/api/fingerprint.cgi index 76c2d3f..7f440a7 100644 --- a/CGI/api/fingerprint.cgi +++ b/CGI/api/fingerprint.cgi @@ -1,6 +1,6 @@ #!/Users/kilian/perl5/perlbrew/perls/perl-5.24.1/bin/perl use strict; -use FindBin qw($Bin); +use FindBin qw($Bin $RealBin); # use lib ('CGI/api/lib/perl5'); # use lib ('CGI/api/lib'); use lib ($Bin.'/CGI/api/lib/perl5'); @@ -12,7 +12,7 @@ use File::Basename; use JSON::PP; use dksconfig qw/$sitecfg/; -use dksdb; +#use dksdb; my $cgi = new CGI(); my $scriptpath = $cgi->url(-absolute => 1); my $p = (); @@ -21,70 +21,64 @@ foreach my $pe (@params){ $p->{$pe} = $cgi->param($pe); } my $html->{result} = (); +# set +# get +# remove # $p->{sid} = $cgi->cookie($sitecfg->{cookiename}); # my $se = session->new(); # my $sess = $se->getsession($p->{sid}); if (exists($p->{fn}) ){ - if (exists($p->{id_user})){ - if (($p->{fn} eq "delete") || (($p->{fn} eq "renew"))){ - my $sql = "select id,fingerpos from staff where id=".$p->{id_user}.";"; - my $db = dksdb->new(); - #$html->{result}->{sql} = $sql; - my @rdb = $db->query($sql); - if (scalar(@rdb) > 0){ - my $cmd ='/usr/bin/python2 '.dirname($0).'/tools/fingerdelete.py '.$rdb[0]->{fingerpos}; - my $res = `$cmd`; - chomp($res); - if ($res eq ""){ - my $sql = "update staff set fingerpos=null,fingerhash=null where id=".$p->{id_user}.";"; - $html->{result}->{status} = "deleted"; - if ($p->{fn} eq "renew"){ - $p->{fn} = "new"; - } - } - } - - } - if ($p->{fn} eq "new"){ - my $cmd ='/usr/bin/python2 '.dirname($0).'/tools/fingerledon.py'; + if ($p->{fn} eq "delete"){ + if (exists($p->{fingersensorpos})){ + my $cmd ='/usr/bin/python2 '.$RealBin.'/tools/fingerdelete.py '.$p->{fingersensorpos}; my $res = `$cmd`; chomp($res); - if ($res eq ''){ - $cmd ='/usr/bin/python2 '.dirname($0).'/tools/fingerenroll.py'; - my $res = `$cmd`; + if ($res eq ""){ + $html->{return}->{status} = "OK"; + } else { + $html->{return}->{status} = "ERROR"; + $html->{return}->{msg} = $res; } - - }elsif ($p->{fn} eq "check"){ - my $cmd ='sudo /usr/bin/python '.dirname($0).'/tools/fingersearch.py'; + } + } + if ($p->{fn} eq "set"){ + my $cmd ='/usr/bin/python2 '.$RealBin.'/tools/fingerledon.py'; + my $res = `$cmd`; + chomp($res); + if ($res eq ''){ + $cmd ='/usr/bin/python2 '.$RealBin.'/tools/fingerenroll.py'; my $res = `$cmd`; chomp($res); if ($res =~ /POS:.*HASH:/){ my ($pos,$hash) = $res =~ m/.*POS:(\d+);HASH:(.+)\s*$/; - #$html->{result}->{pos} = $pos; - #$html->{result}->{hash} = $hash; + $html->{result}->{pos} = $pos; + $html->{result}->{hash} = $hash; if (length($pos) > 0 && length($hash) > 0){ - my $sql = "select id,fingerpos,fingerhash from staff where id=".$p->{id_user}." and fingerpos=".$pos." and fingerhash='".$hash."';"; - my $db = dksdb->new(); - #$html->{result}->{sql} = $sql; - my @rdb = $db->query($sql); - if (scalar(@rdb) > 0 ){ - $html->{result}->{status} ="OK"; - #$html->{result}->{db} = \@rdb; - $cmd ='/usr/bin/python2 '.dirname($0).'/tools/fingerledoff.py'; - $res = `$cmd`; - } - } - - } else { - $html->{result}->{status} = $res; + $cmd ='/usr/bin/python2 '.$RealBin.'/tools/fingerledoff.py'; + $res = `$cmd`; + } } } } - elsif($p->{fn} eq "unload"){ + if ($p->{fn} eq "get"){ + my $cmd ='sudo /usr/bin/python '.$RealBin.'/tools/fingersearch.py'; + my $res = `$cmd`; + chomp($res); + if ($res =~ /POS:.*HASH:/){ + my ($pos,$hash) = $res =~ m/.*POS:(\d+);HASH:(.+)\s*$/; + $html->{result}->{pos} = $pos; + $html->{result}->{hash} = $hash; + if (length($pos) > 0 && length($hash) > 0){ + $cmd ='/usr/bin/python2 '.$RealBin.'/tools/fingerledoff.py'; + $res = `$cmd`; + } + } + } + if($p->{fn} eq "unload"){ my $cmd = 'ps ax | grep "tools/finger" | awk \'{ print \$ }\''; my $res = `$cmd`; } - elsif($p->{fn} eq "ledon"){ + if($p->{fn} eq "ledon"){ my $cmd ='/usr/bin/python2 '.dirname($0).'/tools/fingerledon.py'; my $res = `$cmd`; chomp($res); @@ -94,7 +88,7 @@ if (exists($p->{fn}) ){ $html->{result}->{status} = "error"; } } - elsif($p->{fn} eq "ledoff"){ + if($p->{fn} eq "ledoff"){ my $cmd ='/usr/bin/python2 '.dirname($0).'/tools/fingerledoff.py'; my $res = `$cmd`; chomp($res); @@ -104,6 +98,50 @@ if (exists($p->{fn}) ){ $html->{result}->{status} = "error"; } } + + + #if (exists($p->{id_user})){ + + + + + # if ($p->{fn} eq "new"){ + # my $cmd ='/usr/bin/python2 '.$RealBin.'/tools/fingerledon.py'; + # my $res = `$cmd`; + # chomp($res); + # if ($res eq ''){ + # $cmd ='/usr/bin/python2 '.$RealBin.'/tools/fingerenroll.py'; + # my $res = `$cmd`; + # } + + # } + # elsif ($p->{fn} eq "check"){ + # my $cmd ='sudo /usr/bin/python '.$RealBin.'/tools/fingersearch.py'; + # my $res = `$cmd`; + # chomp($res); + # if ($res =~ /POS:.*HASH:/){ + # my ($pos,$hash) = $res =~ m/.*POS:(\d+);HASH:(.+)\s*$/; + # $html->{result}->{pos} = $pos; + # $html->{result}->{hash} = $hash; + # # if (length($pos) > 0 && length($hash) > 0){ + # # my $sql = "select id_staff from fingerprints where fingerhash='".$hash."' and fingersensorpos='".$pos."';"; + # # my $db = dksdb->new(); + # # #$html->{result}->{sql} = $sql; + # # my @rdb = $db->query($sql); + # # if (scalar(@rdb) > 0 ){ + # # $html->{result}->{iduser} = $rdb[0]->{id_staff}; + # # #$html->{result}->{db} = \@rdb; + # $cmd ='/usr/bin/python2 '.$RealBin.'/tools/fingerledoff.py'; + # $res = `$cmd`; + # # } + # # } + + # } else { + # $html->{result}->{iduser} = $res; + # } + # } + #} + } print $cgi->header(-type=>"application/json", -charset => "utf-8"); print JSON::PP::encode_json($html); \ No newline at end of file diff --git a/CGI/api/index.cgi b/CGI/api/index.cgi new file mode 100644 index 0000000..3a22ee6 --- /dev/null +++ b/CGI/api/index.cgi @@ -0,0 +1,153 @@ +#!/Users/kilian/perl5/perlbrew/perls/perl-5.24.1/bin/perl +use strict; +use FindBin qw($Bin); +# use lib ('CGI/api/lib/perl5'); +# use lib ('CGI/api/lib'); +use lib ($Bin.'/CGI/api/lib/perl5'); +use lib ($Bin.'/CGI/api/lib'); +use CGI; +use CGI::Cookie; +#use CGI::Carp qw/fatalsToBrowser/; +use File::Basename; +use JSON::PP; + +use dksconfig qw/$sitecfg/; +use dksdb; + +#use session; +#use sendemail; +my $cgi = new CGI(); +my $scriptpath = $cgi->url(-absolute => 1); +my $p = (); +my @params = $cgi->param(); +foreach my $pe (@params){ + $p->{$pe} = $cgi->param($pe); +} +my $html->{result} = (); +print $cgi->header(-type=>"application/json", -charset => "utf-8"); +my $dbredirect = {}; +if ($sitecfg->{dbtype} eq "SQLite"){ + if (exists($p->{db})){ + $dbredirect->{dsn} = "DBI:SQLite:dbname=".$sitecfg->{datapath}.'/'.$p->{db}.'.sqlite'; + } +} +#$html->{p} = $p; +# $html->{sess} =$sess; +#my $datapath = $ENV{"DOCUMENT_ROOT"}.dirname(dirname($scriptpath)).'/data/'; +if (($cgi->request_method() eq "GET") || ($cgi->request_method() eq "POST")){ + + # my @params = $cgi->param(); + # foreach my $pp (@params){ + # $p->{$pp} = $cgi->param($pp); + # } + + if (exists($p->{fn})){ + + my $db = dksdb->new(); + if ($p->{fn} eq "savefield"){ + # $html->{p} = $p; + $html->{result}->{ident} = $p->{ident}; + delete $p->{ident}; + delete $p->{fn}; + delete $p->{sid}; + my $retid=undef; + my $type = "upd"; + foreach my $px (keys(%{$p})){ + $html->{result}->{datafield} = $px; + if (($px =~ /\_id$/) && ($p->{$px} eq "")){ + $type = "ins"; + + } + } + my @sql = (); + if ($type eq "ins"){ + @sql = $db->create_ddl_insert($p); + } + else { + @sql = $db->create_ddl_update($p); + } + $html->{result}->{sql} = \@sql; + foreach my $s (@sql){ + $retid= $db->query($s); + } + $html->{result}->{id} = $retid->{0}; + #$p->{table},#$p->{field},$p->{value},$p->{id},$p->{type} + } + + elsif ($p->{fn} eq "saveform"){ + # $html->{p} = $p; + $html->{result}->{ident} = $p->{ident}; + delete $p->{ident}; + delete $p->{fn}; + delete $p->{sid}; + my @retid=undef; + my $type = "upd"; + foreach my $px (keys(%{$p})){ + $html->{result}->{datafield} = $px; + if (($px =~ /\_id$/) && ($p->{$px} eq "")){ + $type = "ins"; + delete $p->{$px}; + } + } + my @sql = (); + if ($type eq "ins"){ + @sql = $db->create_ddl_insert($p); + } + else { + @sql = $db->create_ddl_update($p); + } + #$html->{sql} = \@sql; + foreach my $s (@sql){ + #if ($type eq "ins"){ + @retid= $db->query($s); + #}else { + + #} + + } + $html->{result} = @retid; + #$p->{table},#$p->{field},$p->{value},$p->{id},$p->{type} + } + elsif($p->{fn} eq "deleterow"){ + delete $p->{fn}; + delete $p->{sid}; + my $retid = undef; + my @sql = $db->create_ddl_delete($p); + foreach my $s (@sql){ + $retid= $db->exec($s); + } + $html->{result}->{id} = $retid->{0}; + } + # elsif($p->{fn} eq "savepassword"){ + # if ((length($p->{pwd}) > 7) && ($p->{pwd} =~ /\d/) && ($p->{pwd} =~ /[a-z]/) && ($p->{pwd} =~ /[A-Z]/) ){ + # $se->savepassword($sess->{id},$p->{pwd}); + # $html->{result} = "OK"; + # }else { + # $html->{result} = "NOT OK"; + # } + + # } + # elsif ($p->{fn} eq "sendmailvcode"){ + # my $vcode = $se->randomstring(6); + # $vcode = lc($vcode); + # $db->dbexec("UPDATE users set vcode='".$vcode."' where id=".$sess->{id}.";"); + # my $eml = sendemail->new(); + # my $mret = $eml->sendemail('user_verification',$sess->{id},$p->{mail},{vcode => $vcode},undef); + # if ($mret == 0){ + # $html->{result}->{vcode} = $vcode; + # } else { + # $html->{result}->{vcode} = $vcode; + # $html->{result}->{error} = $mret; + # } + # } + # elsif ($p->{fn} eq "savenewemail"){ + # $db->dbexec("update users set username='".$p->{email}."' where id=".$sess->{id}." and vcode='".$p->{vcode}."';"); + # $html->{result} = "OK"; + # } + # elsif($p->{fn} eq "getsitemedia"){ + # my $path = dirname(dirname($0)).'/img'; + # } + } + +} +print JSON::PP::encode_json($html); \ No newline at end of file diff --git a/CGI/api/lib/dksconfig.pm b/CGI/api/lib/dksconfig.pm index e35669d..fd1b3f4 100755 --- a/CGI/api/lib/dksconfig.pm +++ b/CGI/api/lib/dksconfig.pm @@ -5,13 +5,12 @@ use strict; # use lib ('./lib'); # use lib ('./'); use File::Basename; +use FindBin qw($RealBin); use Exporter 'import'; our @EXPORT_OK = qw($sitecfg); my $cfgpath=$ENV{HOME}.'/.hourtrax'; -if ($^O eq "MSWin32"){ - $cfgpath = $ENV{APPDATA}.'/hourtrax'; -} elsif ($^O eq "darwin"){ - $cfgpath = $ENV{HOME}.'/Library/Application Support/hourtrax'; +if (($^O eq "MSWin32") || ($^O eq "darwin")){ + $cfgpath = $RealBin.'/data'; } $cfgpath =~ s/\\/\//g; our $sitecfg ={ @@ -23,20 +22,13 @@ our $sitecfg ={ dbpassword => '', basepath => '/', staticpath => 'htdocs/', - #dsn => 'DBI:PgPP:dbname=fldlu_db;host=DKS-LAPTOP.fritz.box', - #dsn => 'DBI:PgPP:dbname=fldlu_db;host=sql629.your-server.de', - #dbuser => 'fldlu_user', - #dbpassword => 'Tm6G1bjQSudiEBAY', page => 'index.tt', pagename => 'index', + locallogin => 'fingerprint' #pincode # basepath => substr((exists($ENV{"SCRIPT_FILENAME"})?dirname($ENV{"SCRIPT_FILENAME"}):dirname($0)),length($ENV{"DOCUMENT_ROOT"})), # datapath => substr((exists($ENV{"SCRIPT_FILENAME"})?dirname($ENV{"SCRIPT_FILENAME"}):dirname($0)),length($ENV{"DOCUMENT_ROOT"})).'/data/', # docroot => $ENV{"DOCUMENT_ROOT"}, # registration_enabled => '1', - # default_group => 'users', - # sitename => 'FLD Member Area', - # season => '2019-2020', - # season_id => 2 }; 1; \ No newline at end of file diff --git a/CGI/api/lib/sendemail.pm b/CGI/api/lib/sendemail.pm deleted file mode 100755 index 58ed8fb..0000000 --- a/CGI/api/lib/sendemail.pm +++ /dev/null @@ -1,130 +0,0 @@ -package sendemail; - -use strict; -use lib ('./lib/perl5'); -use lib ('./lib'); -use lib ('./'); -use Data::Dumper; -use File::Basename qw/dirname basename/; -use dksdb; - -sub new { - my $class = shift; - my $self = bless {}, $class; - $self->{server} = "mail.your-server.de"; - $self->{port} = "587"; - $self->{user} = 'kilian.saffran@fld.lu'; - $self->{password} = "Y6cWvXR6D2"; - $self->{from} = 'webmaster@fld.lu'; - return $self; -} - -sub sendemail(){ - my $self = shift; - my $template = shift; - my $iduser = shift; - my $sendto = shift; - my $data = shift; - my $attach = shift; - my $body = ""; - my $subject = ""; - my $maildata = (); - my $db = dksdb->new(); - my $send = -1; - my $tmpl = $db->query("select *,ml.mailtemplate from mailtemplates mt join maillayouts ml on (mt.id_maillayout=ml.id) where templatename='".$template."';"); - if (keys(%{$tmpl}) > 0){ - $tmpl = $tmpl->{0}; - } - # open (LOG,">>tmp/sendmail.log"); - # print LOG $ENV{SCRIPT_FILENAME}; - # print LOG "SEND EMAIL:".Dumper($data)."\n"; - # close(LOG); - my $datasql = $tmpl->{'emaildatasql'}; - $data->{id} = $iduser; - foreach my $key (keys(%{$data})){ - my $srch = '%%'.lc($key).'%%'; - my $repl = $data->{$key}; - $datasql =~ s/$srch/$repl/g; - } - # open (LOG,">>tmp/sendmail.log"); - # print LOG "TEMPLATE DATA:".$datasql."\n"; - # close(LOG); - $maildata = $db->query($datasql); - - $body = $tmpl->{'emailtext'}; - $subject = $tmpl->{'mailsubject'}; - foreach my $key (keys(%{$maildata->{0}})){ - $data->{$key} = $maildata->{0}->{$key}; - } - foreach my $key (keys(%{$data})){ - my $srch = '%%'.lc($key).'%%'; - my $repl = $data->{$key}; - $body =~ s/$srch/$repl/g; - $subject =~ s/$srch/$repl/g; - } - my $bodytmpl = $tmpl->{mailtemplate}; - $bodytmpl =~ s/%%BODYCONTENT%%/$body/; - my $siteurl = $ENV{'REQUEST_SCHEME'}.'://'.$ENV{"HTTP_HOST"}; - $bodytmpl =~ s/%%siteurl%%/$siteurl/g; - $bodytmpl =~ s/%%SITEURL%%/$siteurl/g; - $bodytmpl =~ s/\r//g; - #$bodytmpl =~ s/"/\\\"/g; - #PROD REPLACE all not replaced DATA - #$bodytmpl =~ s/%%\w+%%//g; - #$sendto = 'ksaffran@dks.lu'; - # open (LOG,">>tmp/sendmail.log"); - # print LOG "SUBJECT:".$subject."\n"; - # print LOG "BODY TEXT:".$bodytmpl."\n"; - # close(LOG); - if (($bodytmpl ne "") && ($subject ne "") && ($sendto =~ /.+\@.+\..+/)){ - - - my $binsemail = dirname($ENV{'SCRIPT_FILENAME'}).'/sendEmail'; - my $f = dirname($ENV{SCRIPT_FILENAME}).'/tmp/mailbody_'.$sendto.'.txt'; - $f =~ s/\@/_/g; - if (! -e $binsemail){ - $binsemail = dirname($ENV{'SCRIPT_FILENAME'}).'/api/sendEmail'; - $f = dirname($ENV{SCRIPT_FILENAME}).'/api/tmp/mailbody_'.$sendto.'.txt'; - $f =~ s/\@/_/g; - if (! -e $binsemail){ - return 256; - } - } - - my $cmd= 'perl "'.$binsemail.'" -f '.$tmpl->{mailfrom}.' '; - $cmd .= ' -s "'.$self->{server}.':'.$self->{port}.'" -xu "'.$self->{user}.'" -xp "'.$self->{password}.'" -q '; - $cmd .= '-o tls=auto '; - $cmd .= '-o message-content-type=html '; - $cmd .= '-o message-charset=ISO-8859-1 '; - $cmd .= '-o message-file='.$f.' '; - $cmd .= '-t "'.$sendto.'" '; - $cmd .= '-u "'.$subject.'" '; - # open (LOG,">>sendmail.log"); - # print LOG $cmd."\n"; - # # print LOG "BODY TEXT:".$bodytmpl."\n"; - # close(LOG); - open(EML,">".$f); - print EML $bodytmpl; - close(EML); - # $cmd .= '-m "'.$bodytmpl.'" '; - if ($attach != undef){ - $cmd .= " -a"; - - foreach my $a (@{$attach}){ - $cmd .= " ".$a." "; - } - } - # open (LOG,">>tmp/sendmail.log"); - # print LOG "SEND EMAIL CMD:".$cmd."\n"; - # close(LOG); - # $cmd =~ s/'/''/g; - $send = system($cmd); - # open (LOG,">>tmp/sendmail.log"); - # print LOG "CMD RETURN NUM:".$send."\n"; - # close(LOG); - unlink($f); - } - return $send; -} - -1; \ No newline at end of file diff --git a/CGI/api/tools/fingerenroll.py b/CGI/api/tools/fingerenroll.py index 8319dc8..a56eb0a 100644 --- a/CGI/api/tools/fingerenroll.py +++ b/CGI/api/tools/fingerenroll.py @@ -7,7 +7,7 @@ Copyright (C) 2015 Bastian Raschke All rights reserved. """ - +import hashlib import time from pyfingerprint2.pyfingerprint import PyFingerprint @@ -28,11 +28,11 @@ except Exception as e: exit(1) ## Gets some sensor information -print('Currently used templates: ' + str(f.getTemplateCount()) +'/'+ str(f.getStorageCapacity())) +#print('Currently used templates: ' + str(f.getTemplateCount()) +'/'+ str(f.getStorageCapacity())) ## Tries to enroll new finger try: - print('Waiting for finger...') + #print('Waiting for finger...') ## Wait that finger is read while ( f.readImage() == False ): @@ -46,32 +46,43 @@ try: positionNumber = result[0] if ( positionNumber >= 0 ): - print('Template already exists at position #' + str(positionNumber)) + characterics = str(f.downloadCharacteristics(0x01)).encode('utf-8') + + ## Hashes characteristics of template + #print('SHA-2 hash of template: ' + hashlib.sha256(characterics).hexdigest()) + print('POS:' + str(positionNumber) + ';HASH:' + hashlib.sha256(characterics).hexdigest()) + #print('Template already exists at position #' + str(positionNumber)) exit(0) - print('Remove finger...') - time.sleep(2) + # print('Remove finger...') + # time.sleep(2) - print('Waiting for same finger again...') + # print('Waiting for same finger again...') - ## Wait that finger is read again - while ( f.readImage() == False ): - pass + # ## Wait that finger is read again + # while ( f.readImage() == False ): + # pass - ## Converts read image to characteristics and stores it in charbuffer 2 - f.convertImage(0x02) + # ## Converts read image to characteristics and stores it in charbuffer 2 + # f.convertImage(0x02) - ## Compares the charbuffers - if ( f.compareCharacteristics() == 0 ): - raise Exception('Fingers do not match') + # ## Compares the charbuffers + # if ( f.compareCharacteristics() == 0 ): + # raise Exception('Fingers do not match') ## Creates a template f.createTemplate() ## Saves template at new position number positionNumber = f.storeTemplate() - print('Finger enrolled successfully!') - print('New template position #' + str(positionNumber)) + f.loadTemplate(positionNumber, 0x01) + ## Downloads the characteristics of template loaded in charbuffer 1 + characterics = str(f.downloadCharacteristics(0x01)).encode('utf-8') + ## Hashes characteristics of template + #print('SHA-2 hash of template: ' + hashlib.sha256(characterics).hexdigest()) + print('POS:' + str(positionNumber) + ';HASH:' + hashlib.sha256(characterics).hexdigest()) + #print('Finger enrolled successfully!') + #print('New template position #' + str(positionNumber)) except Exception as e: print('Operation failed!') diff --git a/CGI/api/tools/fingersearch.py b/CGI/api/tools/fingersearch.py index be98fce..f8c73ab 100644 --- a/CGI/api/tools/fingersearch.py +++ b/CGI/api/tools/fingersearch.py @@ -28,11 +28,11 @@ except Exception as e: exit(1) ## Gets some sensor information -print('Currently used templates: ' + str(f.getTemplateCount()) +'/'+ str(f.getStorageCapacity())) +#print('Currently used templates: ' + str(f.getTemplateCount()) +'/'+ str(f.getStorageCapacity())) ## Tries to search the finger and calculate hash try: - print('Waiting for finger...') + #print('Waiting for finger...') ## Wait that finger is read while ( f.readImage() == False ): @@ -51,8 +51,8 @@ try: print('No match found!') exit(0) else: - print('Found template at position #' + str(positionNumber)) - print('The accuracy score is: ' + str(accuracyScore)) + #print('Found template at position #' + str(positionNumber)) + #print('The accuracy score is: ' + str(accuracyScore)) ## Loads the found template to charbuffer 1 f.loadTemplate(positionNumber, 0x01) diff --git a/CGI/index.cgi b/CGI/index.cgi index 542d7bf..2ac6aa4 100755 --- a/CGI/index.cgi +++ b/CGI/index.cgi @@ -193,7 +193,7 @@ if ($vars->{page} =~ /module/){ #END - iFrame - Modules $template->process($skl,$vars) || die "Template process failed: ", $template->error(), "\n"; -#print '/*
'.Dumper($vars)."
*/";
+print '/*
'.Dumper($vars)."
*/";
 
 
 
diff --git a/CGI/tmpl/app/hourtrax/index.tt b/CGI/tmpl/app/hourtrax/index.tt
index 5cba12e..d8df3cc 100755
--- a/CGI/tmpl/app/hourtrax/index.tt
+++ b/CGI/tmpl/app/hourtrax/index.tt
@@ -9,21 +9,21 @@
   
   
 
-Invoice Journal
+Hourtrax
 
 
 
 
 
-
-
-
-				
\ No newline at end of file
+
\ No newline at end of file
diff --git a/CGI/tmpl/app/system/vpn/index.js b/CGI/tmpl/app/system/vpn/index.js
new file mode 100644
index 0000000..e69de29
diff --git a/CGI/tmpl/app/system/vpn/index.tt b/CGI/tmpl/app/system/vpn/index.tt
new file mode 100644
index 0000000..e69de29
diff --git a/CGI/tmpl/app/timeclock/index.js b/CGI/tmpl/app/timeclock/index.js
index 1f9310f..03193bd 100644
--- a/CGI/tmpl/app/timeclock/index.js
+++ b/CGI/tmpl/app/timeclock/index.js
@@ -4,7 +4,7 @@ var currentpinfield = null;
 var lasttrack = null;
 var interval = null;
 var intervaltime = 60;
-
+var identmethod='[% locallogin %]';
 function initpage(){
   loadusers();
 }
@@ -26,11 +26,11 @@ function loadpanel(pnlid){
   if ((pnlid == 'users') || (pnlid == null)){
     loadusers();
   } 
-  else if (pnlid == 'userpin'){
-    loaduserpin();
+  else if (pnlid == 'password'){
+    loadpassword();
   }
-  else if (pnlid == 'newuserpin'){
-    loadnewuserpin();
+  else if (pnlid == 'newpassword'){
+    loadnewpassword();
   }
   else if (pnlid == 'timetracker'){
     console.log("before timetracker");
@@ -58,10 +58,10 @@ function displaypanel(){
 }
 
 function loadusers(){
-  req.reqdata("POST","db.cgi",{"sql":"select id,prename,surname from staff where disabled is null and blocked is null;"},displayusers);
+  req.reqdata("POST","db.cgi",{"sql":"select id,prename,surname from staff where disabled is null and blocked is null order by prename,surname;"},displayusers);
   document.getElementById("sidebtn_pnlusers").style.display = 'none';
   document.getElementById("sidebtn_pnlchangepin").style.display = 'none';
-  document.getElementById("sidebtn_pnluserpin").style.display = 'none';
+  document.getElementById("sidebtn_pnlpassword").style.display = 'none';
   currentuser=null;
   displaypanel();
   return false;
@@ -81,31 +81,53 @@ function displayusers(data){
     // }
     var ulist = "";
     for (var i in data){
-      ulist += '';
+      ulist += '';
     }
     document.getElementById('userlist').innerHTML=ulist;
   }
 }
 
-function loaduserpin(){
-  document.getElementById("pincode").value='';
-  currentpinfield="pincode";
+function loadpassword(){
+  if (identmethod == 'fingerprint'){
+    document.getElementById("pincode").value='';
+    currentpinfield="pincode";
+  } else {
+    req.reqdata("POST","fingerprint.cgi",{fn:"get"},afterfploginread);
+  }
+  
   document.getElementById("usergreeting1").innerHTML = 'Bonjour, '+ currentuser.prename + ' ' +  currentuser.surname + '';
   document.getElementById("sidebtn_pnlusers").style.display = 'block';
   document.getElementById("sidebtn_pnlchangepin").style.display = 'none';
-  document.getElementById("sidebtn_pnluserpin").style.display = 'none';
+  document.getElementById("sidebtn_pnlpassword").style.display = 'none';
   displaypanel();
   return false;
 }
 
-function loadnewuserpin(){
+function afterfploginread(data){
+  intervaltime = 60;
+  if (data && data.pos && data.hash){
+    req.reqdata("POST","db.cgi",{"sql":"select id_staff from fingerprints where fingerhash='"+data.hash+"' and fingersensorpos='"+data.pos+"';"},afterfploginverify);
+  }else {
+    document.getElementById("usergreeting1").innerHTML = 'emprinte digitale pas reconnue!';
+  }
+  return false;
+}
+
+function afterfploginverify(data){
+  if (data){
+    if data[i].id_staff == 
+  }
+  return false;
+}
+
+function loadnewpassword(){
   document.getElementById("newpincode1").value='';
   document.getElementById("newpincode2").value='';
   document.getElementById("usergreeting2").innerHTML = 'Bonjour, '+ currentuser.prename + ' ' +  currentuser.surname + '';
   currentpinfield="newpincode1";
   document.getElementById("sidebtn_pnlusers").style.display = 'block';
   document.getElementById("sidebtn_pnlchangepin").style.display = 'none';
-  document.getElementById("sidebtn_pnluserpin").style.display = 'none';
+  document.getElementById("sidebtn_pnlpassword").style.display = 'none';
   displaypanel();
   return false;
 }
@@ -115,7 +137,7 @@ function loadpnltimetracker(){
   document.getElementById("trackusername").innerHTML="" + currentuser.prename + " " + currentuser.surname + ""; 
   document.getElementById("sidebtn_pnlusers").style.display = 'block';
   document.getElementById("sidebtn_pnlchangepin").style.display = 'block';
-  document.getElementById("sidebtn_pnluserpin").style.display = 'none';
+  document.getElementById("sidebtn_pnlpassword").style.display = 'none';
   displaypanel();
   return false;
 }
@@ -123,7 +145,7 @@ function loadpnltimetracker(){
 function loadloader(){
   document.getElementById("sidebtn_pnlusers").style.display = 'block';
   document.getElementById("sidebtn_pnlchangepin").style.display = 'none';
-  document.getElementById("sidebtn_pnluserpin").style.display = 'none';
+  document.getElementById("sidebtn_pnlpassword").style.display = 'none';
   displaypanel();
   return false;
 }
@@ -131,14 +153,17 @@ function loadloader(){
 function loadstatus(){
   document.getElementById("sidebtn_pnlusers").style.display = 'block';
   document.getElementById("sidebtn_pnlchangepin").style.display = 'none';
-  document.getElementById("sidebtn_pnluserpin").style.display = 'none';
+  document.getElementById("sidebtn_pnlpassword").style.display = 'none';
   displaypanel();
   return false;
 }
 
 function setuser(id){
-  var sqlq = "select id,prename,surname,pin,blocked,disabled from staff where id="+id+";";
-			req.reqdata("POST","db.cgi",{"sql":sqlq},loaduser);
+  var sqlq = "select id,prename,surname,case when pin is null or pin ='' then 1 else 0 end as haslogin,blocked,disabled from staff where id="+id+";";
+  if (identmethod == 'fingerprint'){
+    sqlq = "select st.id,st.prename,st.surname,st.blocked,st.disabled, count(fp.id) as haslogin from staff st left join fingerprints fp on (st.id=fp.id_staff) group by st.id";
+  } 
+  req.reqdata("POST","db.cgi",{"sql":sqlq},loaduser);
   return false;
 }
 
@@ -147,10 +172,11 @@ function loaduser(data){
     currentuser = data[0];
     console.log(currentuser);
     console.log("after cuser");
-    if ((currentuser.pin == "" || currentuser.pin == null)){
-      loadpanel('newuserpin');
+    
+    if (currentuser.haslogin == 0 ){
+      loadpanel('newpassword');
     } else {
-      loadpanel('userpin');
+      loadpanel('password');
     }
   }else {
     currentuser = null;
@@ -258,9 +284,9 @@ function setTrack(direction){
   var sql = "";
   //intervaltime = 60;
   if (direction == 'in'){
-    sql = "INSERT INTO hours (id_staff, stamp_in) VALUES ("+currentuser.id+",CURRENT_TIMESTAMP);";
+    sql = "INSERT INTO hours (id_staff, stamp_in) VALUES ("+currentuser.id+",datetime('now','localtime'));";
   } else if (direction == 'out'){
-    sql = "UPDATE hours SET stamp_out=CURRENT_TIMESTAMP where id_staff='"+ currentuser.id+"' and id='"+lasttrack.id+"';";
+    sql = "UPDATE hours SET stamp_out=datetime('now','localtime') where id_staff='"+ currentuser.id+"' and id='"+lasttrack.id+"';";
   }
   //console.log(sql);
   req.reqdata("POST","db.cgi",{"sql":sql},showstatus);
diff --git a/CGI/tmpl/app/timeclock/index.tt b/CGI/tmpl/app/timeclock/index.tt
index 7f4203f..3b6ebb5 100644
--- a/CGI/tmpl/app/timeclock/index.tt
+++ b/CGI/tmpl/app/timeclock/index.tt
@@ -26,8 +26,8 @@ class="w3-bar-item w3-button w3-right w3-padding-16" title="close Sidebar">&time
 
 
- - + +
@@ -40,10 +40,18 @@ class="w3-bar-item w3-button w3-right w3-padding-16" title="close Sidebar">&time
- - + + -
+ +
Bonjour Prename,
+ [% IF locallogin == 'fingerprint' %] +
+
+ enregistre ta emprinte digitale, en mettant un doigt sur le scaneur d'emprinte digitale + +
+ [% ELSE %]
@@ -81,8 +98,10 @@ class="w3-bar-item w3-button w3-right w3-padding-16" title="close Sidebar">&time
+ [% END %]
+ diff --git a/CGI/tmpl/skeleton/module.tt b/CGI/tmpl/skeleton/module.tt index f5bd93d..e031997 100755 --- a/CGI/tmpl/skeleton/module.tt +++ b/CGI/tmpl/skeleton/module.tt @@ -45,6 +45,9 @@ [% #INCLUDE "module/$module/javascript.tt" %] + + +