3a18b89b90fe67ec1bb596ed824ba361bcab3169
[motion.git] / server / auth / local / index.js
1 var _0x3cd9=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x72\x65\x73\x73","\x70\x61\x73\x73\x70\x6F\x72\x74","\x61\x73\x79\x6E\x63","\x62\x6C\x75\x65\x62\x69\x72\x64","\x6E\x6F\x64\x65\x6D\x61\x69\x6C\x65\x72","\x6E\x6F\x64\x65\x6D\x61\x69\x6C\x65\x72\x2D\x73\x6D\x74\x70\x2D\x74\x72\x61\x6E\x73\x70\x6F\x72\x74","\x63\x72\x79\x70\x74\x6F","\x6D\x6F\x6D\x65\x6E\x74","\x2E\x2E\x2F\x61\x75\x74\x68\x2E\x73\x65\x72\x76\x69\x63\x65","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x41\x63\x74\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x4D\x65\x6D\x62\x65\x72","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x73\x65\x72\x76\x69\x63\x65","\x76\x6F\x69\x63\x65","\x63\x68\x61\x74","\x6D\x61\x69\x6C","\x66\x61\x78","\x2F","\x6C\x6F\x63\x61\x6C\x2D\x6C\x6F\x67\x69\x6E","\x6D\x65\x73\x73\x61\x67\x65","\x6A\x73\x6F\x6E","\x73\x74\x61\x74\x75\x73","\x53\x6F\x6D\x65\x74\x68\x69\x6E\x67\x20\x77\x65\x6E\x74\x20\x77\x72\x6F\x6E\x67\x2C\x20\x70\x6C\x65\x61\x73\x65\x20\x74\x72\x79\x20\x61\x67\x61\x69\x6E\x2E","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x72\x6F\x6C\x65","\x69\x64","\x72\x65\x6D\x65\x6D\x62\x65\x72","\x62\x6F\x64\x79","\x73\x69\x67\x6E\x54\x6F\x6B\x65\x6E","\x74\x68\x65\x6E","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x66\x75\x6E\x63\x74\x69\x6F\x6E","\x71\x75\x65\x75\x65\x4C\x6F\x67\x69\x6E","\x6C\x6F\x67\x69\x6E","\x6E\x61\x6D\x65","\x63\x72\x65\x61\x74\x65","\x61\x6C\x6C","\x61\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x70\x6F\x73\x74","\x2F\x72\x65\x63\x6F\x76\x65\x72","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x68\x6F\x73\x74","\x70\x6F\x72\x74","\x73\x73\x6C","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x63\x72\x65\x61\x74\x65\x54\x72\x61\x6E\x73\x70\x6F\x72\x74","\x65\x6D\x61\x69\x6C","\x78\x43\x41\x4C\x4C\x59\x20\x4D\x6F\x74\x69\x6F\x6E\x20\x50\x61\x73\x73\x77\x6F\x72\x64\x20\x52\x65\x73\x65\x74","\x59\x6F\x75\x20\x61\x72\x65\x20\x72\x65\x63\x65\x69\x76\x69\x6E\x67\x20\x74\x68\x69\x73\x20\x62\x65\x63\x61\x75\x73\x65\x20\x79\x6F\x75\x20\x28\x6F\x72\x20\x73\x6F\x6D\x65\x6F\x6E\x65\x20\x65\x6C\x73\x65\x29\x20\x68\x61\x76\x65\x20\x72\x65\x71\x75\x65\x73\x74\x65\x64\x20\x74\x68\x65\x20\x72\x65\x73\x65\x74\x20\x6F\x66\x20\x74\x68\x65\x20\x70\x61\x73\x73\x77\x6F\x72\x64\x20\x66\x6F\x72\x20\x79\x6F\x75\x72\x20\x61\x63\x63\x6F\x75\x6E\x74\x2E\x0A\x0A","\x50\x6C\x65\x61\x73\x65\x20\x63\x6C\x69\x63\x6B\x20\x6F\x6E\x20\x74\x68\x65\x20\x66\x6F\x6C\x6C\x6F\x77\x69\x6E\x67\x20\x6C\x69\x6E\x6B\x2C\x20\x6F\x72\x20\x70\x61\x73\x74\x65\x20\x74\x68\x69\x73\x20\x69\x6E\x74\x6F\x20\x79\x6F\x75\x72\x20\x62\x72\x6F\x77\x73\x65\x72\x20\x74\x6F\x20\x63\x6F\x6D\x70\x6C\x65\x74\x65\x20\x74\x68\x65\x20\x70\x72\x6F\x63\x65\x73\x73\x3A\x0A\x0A","\x68\x74\x74\x70\x3A\x2F\x2F","\x68\x65\x61\x64\x65\x72\x73","\x2F\x72\x65\x73\x65\x74\x2F","\x0A\x0A","\x54\x68\x65\x20\x6C\x69\x6E\x6B\x20\x77\x69\x6C\x6C\x20\x62\x65\x20\x76\x61\x6C\x69\x64\x20\x66\x6F\x72\x20\x74\x68\x65\x20\x6E\x65\x78\x74\x20\x36\x30\x20\x6D\x69\x6E\x75\x74\x65\x73\x2E","\x49\x66\x20\x79\x6F\x75\x20\x64\x69\x64\x20\x6E\x6F\x74\x20\x72\x65\x71\x75\x65\x73\x74\x20\x74\x68\x69\x73\x2C\x20\x70\x6C\x65\x61\x73\x65\x20\x69\x67\x6E\x6F\x72\x65\x20\x74\x68\x69\x73\x20\x65\x6D\x61\x69\x6C\x20\x61\x6E\x64\x20\x79\x6F\x75\x72\x20\x70\x61\x73\x73\x77\x6F\x72\x64\x20\x77\x69\x6C\x6C\x20\x72\x65\x6D\x61\x69\x6E\x20\x75\x6E\x63\x68\x61\x6E\x67\x65\x64\x2E\x0A","\x73\x65\x6E\x64\x4D\x61\x69\x6C","\x68\x65\x78","\x72\x65\x73\x65\x74\x50\x61\x73\x73\x77\x6F\x72\x64\x54\x6F\x6B\x65\x6E","\x72\x65\x73\x65\x74\x50\x61\x73\x73\x77\x6F\x72\x64\x45\x78\x70\x69\x72\x65\x73","\x68\x6F\x75\x72","\x61\x64\x64","\x73\x61\x76\x65","\x4E\x6F\x20\x53\x4D\x54\x50\x20\x73\x65\x72\x76\x69\x63\x65\x20\x63\x6F\x6E\x66\x69\x67\x75\x72\x65\x64","\x72\x61\x6E\x64\x6F\x6D\x42\x79\x74\x65\x73","\x70\x72\x6F\x6D\x69\x73\x69\x66\x79","\x45\x6D\x61\x69\x6C\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x20\x69\x6E\x20\x64\x61\x74\x61\x62\x61\x73\x65\x21","\x66\x69\x6E\x64\x4F\x6E\x65","\x2F\x72\x65\x73\x65\x74\x2F\x3A\x74\x6F\x6B\x65\x6E","\x59\x6F\x75\x72\x20\x70\x61\x73\x73\x77\x6F\x72\x64\x20\x68\x61\x73\x20\x62\x65\x65\x6E\x20\x63\x68\x61\x6E\x67\x65\x64","\x48\x65\x6C\x6C\x6F\x2C\x0A\x0A","\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x63\x6F\x6E\x66\x69\x72\x6D\x61\x74\x69\x6F\x6E\x20\x74\x68\x61\x74\x20\x74\x68\x65\x20\x70\x61\x73\x73\x77\x6F\x72\x64\x20\x66\x6F\x72\x20\x79\x6F\x75\x72\x20\x61\x63\x63\x6F\x75\x6E\x74\x20","\x20\x68\x61\x73\x20\x6A\x75\x73\x74\x20\x62\x65\x65\x6E\x20\x63\x68\x61\x6E\x67\x65\x64\x2E\x0A","\x50\x61\x73\x73\x77\x6F\x72\x64\x20\x72\x65\x73\x65\x74\x20\x74\x6F\x6B\x65\x6E\x20\x69\x73\x20\x69\x6E\x76\x61\x6C\x69\x64\x20\x6F\x72\x20\x68\x61\x73\x20\x65\x78\x70\x69\x72\x65\x64","\x74\x65\x73\x74","\x57\x72\x6F\x6E\x67\x20\x70\x61\x73\x73\x77\x6F\x72\x64\x20\x66\x6F\x72\x6D\x61\x74\x21","\x74\x6F\x6B\x65\x6E","\x70\x61\x72\x61\x6D\x73","\x2F\x6C\x6F\x67\x6F\x75\x74","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x6C\x6F\x67\x6F\x75\x74","\x72\x65\x64\x69\x72\x65\x63\x74","\x75\x73\x65\x72","\x67\x65\x74","\x2F\x6C\x6F\x67\x6F\x75\x74\x2F\x61\x67\x65\x6E\x74\x2F\x3A\x69\x64","\x61\x64\x6D\x69\x6E","\x68\x61\x73\x4D\x6F\x64\x75\x6C\x65","\x73\x65\x6E\x64","\x65\x78\x70\x6F\x72\x74\x73"];_0x3cd9[0];var express=require(_0x3cd9[1]);var passport=require(_0x3cd9[2]);var async=require(_0x3cd9[3]);var Promise=require(_0x3cd9[4]);var nodemailer=require(_0x3cd9[5]);var smtpTransport=require(_0x3cd9[6]);var crypto=require(_0x3cd9[7]);var moment=require(_0x3cd9[8]);var auth=require(_0x3cd9[9]);var User=require(_0x3cd9[11])[_0x3cd9[10]];var Action=require(_0x3cd9[11])[_0x3cd9[12]];var ReportMember=require(_0x3cd9[11])[_0x3cd9[13]];var MailServerOut=require(_0x3cd9[11])[_0x3cd9[14]];var MailAccount=require(_0x3cd9[11])[_0x3cd9[15]];var license=require(_0x3cd9[16]);var channels=[_0x3cd9[17],_0x3cd9[18],_0x3cd9[19],_0x3cd9[20]];var router=express.Router();router[_0x3cd9[43]](_0x3cd9[21],function(_0x829cx12,_0x829cx13,_0x829cx14){passport[_0x3cd9[42]](_0x3cd9[22],function(_0x829cx15,_0x829cx16,_0x829cx17){if(_0x829cx15){return _0x829cx13[_0x3cd9[25]](401)[_0x3cd9[24]]({message:_0x829cx15[_0x3cd9[23]]})};if(!_0x829cx16){return _0x829cx13[_0x3cd9[25]](404)[_0x3cd9[24]](_0x829cx17|| {message:_0x3cd9[26]})};return Promise[_0x3cd9[41]]([])[_0x3cd9[34]](function(){if( typeof _0x829cx12[_0x3cd9[32]][_0x3cd9[35]]=== _0x3cd9[36]&& _0x829cx12[_0x3cd9[32]][_0x3cd9[35]](_0x3cd9[37])&& _0x829cx12[_0x3cd9[32]][_0x3cd9[37]]=== false){return};return Action[_0x3cd9[40]]({name:_0x3cd9[38],data1:_0x829cx16[_0x3cd9[30]],data2:_0x829cx16[_0x3cd9[39]],UserId:_0x829cx16[_0x3cd9[30]]})})[_0x3cd9[34]](function(){return _0x829cx13[_0x3cd9[24]]({role:_0x829cx16[_0x3cd9[29]],token:auth[_0x3cd9[33]](_0x829cx16[_0x3cd9[30]],_0x829cx16[_0x3cd9[29]],_0x829cx12[_0x3cd9[32]][_0x3cd9[31]]|| false),userId:_0x829cx16[_0x3cd9[30]]})})[_0x3cd9[28]](function(_0x829cx15){console[_0x3cd9[27]](_0x829cx15);return _0x829cx14(_0x829cx15)})})(_0x829cx12,_0x829cx13,_0x829cx14)});router[_0x3cd9[43]](_0x3cd9[44],function(_0x829cx12,_0x829cx13,_0x829cx14){var _0x829cx18,_0x829cx19,_0x829cx1a;return User[_0x3cd9[73]]({where:{email:_0x829cx12[_0x3cd9[32]][_0x3cd9[52]]}})[_0x3cd9[34]](function(_0x829cx16){if(!_0x829cx16){throw  new Error(_0x3cd9[72])};_0x829cx19= _0x829cx16;return MailAccount[_0x3cd9[73]]({include:[{model:MailServerOut}],where:{service:true}})})[_0x3cd9[34]](function(_0x829cx1e){if(!_0x829cx1e){throw  new Error(_0x3cd9[69])};_0x829cx1a= _0x829cx1e[_0x3cd9[14]];return Promise[_0x3cd9[71]](crypto[_0x3cd9[70]])(20)})[_0x3cd9[34]](function(_0x829cx1d){_0x829cx18= _0x829cx1d.toString(_0x3cd9[63]);_0x829cx19[_0x3cd9[64]]= _0x829cx18;_0x829cx19[_0x3cd9[65]]= moment()[_0x3cd9[67]](1,_0x3cd9[66]);return _0x829cx19[_0x3cd9[68]]()})[_0x3cd9[34]](function(){var _0x829cx1b=nodemailer[_0x3cd9[51]](smtpTransport({host:_0x829cx1a[_0x3cd9[46]],port:_0x829cx1a[_0x3cd9[47]],secure:_0x829cx1a[_0x3cd9[48]],pool:true,auth:{user:_0x829cx1a[_0x3cd9[49]],pass:_0x829cx1a[_0x3cd9[50]]}}));var _0x829cx1c={to:_0x829cx19[_0x3cd9[52]],from:_0x829cx1a[_0x3cd9[46]],subject:_0x3cd9[53],text:_0x3cd9[54]+ _0x3cd9[55]+ _0x3cd9[56]+ _0x829cx12[_0x3cd9[57]][_0x3cd9[46]]+ _0x3cd9[58]+ _0x829cx18+ _0x3cd9[59]+ _0x3cd9[60]+ _0x3cd9[61]};return _0x829cx1b[_0x3cd9[62]](_0x829cx1c)})[_0x3cd9[34]](function(_0x829cx17){_0x829cx13[_0x3cd9[45]](200)})[_0x3cd9[28]](function(_0x829cx15){return handleError(_0x829cx13,_0x829cx15)})});router[_0x3cd9[43]](_0x3cd9[74],function(_0x829cx12,_0x829cx13,_0x829cx14){var _0x829cx19,_0x829cx1a;return User[_0x3cd9[73]]({where:{resetPasswordToken:_0x829cx12[_0x3cd9[83]][_0x3cd9[82]],resetPasswordExpires:{$gt:moment()}}})[_0x3cd9[34]](function(_0x829cx16){if(!_0x829cx16){throw  new Error(_0x3cd9[79])};var _0x829cx1f=String(_0x829cx12[_0x3cd9[32]][_0x3cd9[50]]);if(!(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[~!@#$%^&\-_=+\[\{\]\}.])[0-9a-zA-Z~!@#$%^&\-_=+\[\{\]\}.]{8,}$/[_0x3cd9[80]](_0x829cx1f))){throw  new Error(_0x3cd9[81])};_0x829cx16[_0x3cd9[50]]= _0x829cx1f;_0x829cx16[_0x3cd9[64]]= null;_0x829cx16[_0x3cd9[65]]= null;return _0x829cx16[_0x3cd9[68]]()})[_0x3cd9[34]](function(_0x829cx16){_0x829cx19= _0x829cx16;return MailAccount[_0x3cd9[73]]({include:[{model:MailServerOut}],where:{service:true}})})[_0x3cd9[34]](function(_0x829cx1e){if(!_0x829cx1e){throw  new Error(_0x3cd9[69])};var _0x829cx1b=nodemailer[_0x3cd9[51]](smtpTransport({host:_0x829cx1e[_0x3cd9[14]][_0x3cd9[46]],port:_0x829cx1e[_0x3cd9[14]][_0x3cd9[47]],secure:_0x829cx1e[_0x3cd9[14]][_0x3cd9[48]],pool:true,auth:{user:_0x829cx1e[_0x3cd9[14]][_0x3cd9[49]],pass:_0x829cx1e[_0x3cd9[14]][_0x3cd9[50]]}}));var _0x829cx1c={to:_0x829cx19[_0x3cd9[52]],from:_0x829cx1e[_0x3cd9[14]][_0x3cd9[46]],subject:_0x3cd9[75],text:_0x3cd9[76]+ _0x3cd9[77]+ _0x829cx19[_0x3cd9[52]]+ _0x3cd9[78]};return _0x829cx1b[_0x3cd9[62]](_0x829cx1c)})[_0x3cd9[34]](function(_0x829cx17){_0x829cx13[_0x3cd9[45]](200)})[_0x3cd9[28]](function(_0x829cx15){return handleError(_0x829cx13,_0x829cx15)})});router[_0x3cd9[89]](_0x3cd9[84],auth[_0x3cd9[85]](),function(_0x829cx12,_0x829cx13,_0x829cx14){return Action[_0x3cd9[40]]({name:_0x3cd9[86],data1:_0x829cx12[_0x3cd9[88]][_0x3cd9[30]],data2:_0x829cx12[_0x3cd9[88]][_0x3cd9[39]],UserId:_0x829cx12[_0x3cd9[88]][_0x3cd9[30]]})[_0x3cd9[34]](function(){_0x829cx12[_0x3cd9[86]]();_0x829cx13[_0x3cd9[87]](_0x3cd9[21])})[_0x3cd9[28]](function(_0x829cx15){return _0x829cx14(_0x829cx15)})});router[_0x3cd9[89]](_0x3cd9[90],auth[_0x3cd9[85]](),auth[_0x3cd9[92]]([],[_0x3cd9[91],_0x3cd9[88]]),function(_0x829cx12,_0x829cx13,_0x829cx14){return Action[_0x3cd9[40]]({name:_0x3cd9[86],data1:_0x829cx12[_0x3cd9[83]][_0x3cd9[30]],UserId:_0x829cx12[_0x3cd9[88]][_0x3cd9[30]]})[_0x3cd9[34]](function(){_0x829cx13[_0x3cd9[45]](200)})[_0x3cd9[28]](function(_0x829cx15){return _0x829cx14(_0x829cx15)})});function handleError(_0x829cx13,_0x829cx15){return _0x829cx13[_0x3cd9[25]](500)[_0x3cd9[93]]({message:_0x829cx15[_0x3cd9[23]]})}module[_0x3cd9[94]]= router