a569bc128f1ebddd132c1063678acba21063e93f
[motion.git] / server / auth / local / index.js
1 var _0xd5bc=["\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","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x6C\x6F\x67\x69\x6E\x49\x6E\x50\x61\x75\x73\x65","\x76\x6F\x69\x63\x65\x50\x61\x75\x73\x65","\x63\x68\x61\x74\x50\x61\x75\x73\x65","\x6D\x61\x69\x6C\x50\x61\x75\x73\x65","\x66\x61\x78\x50\x61\x75\x73\x65","\x73\x6D\x73\x50\x61\x75\x73\x65","\x6F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x50\x61\x75\x73\x65","\x70\x61\x75\x73\x65\x54\x79\x70\x65","\x4C\x4F\x47\x49\x4E\x49\x4E\x50\x41\x55\x53\x45","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\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"];_0xd5bc[0];var express=require(_0xd5bc[1]);var passport=require(_0xd5bc[2]);var async=require(_0xd5bc[3]);var Promise=require(_0xd5bc[4]);var nodemailer=require(_0xd5bc[5]);var smtpTransport=require(_0xd5bc[6]);var crypto=require(_0xd5bc[7]);var moment=require(_0xd5bc[8]);var auth=require(_0xd5bc[9]);var User=require(_0xd5bc[11])[_0xd5bc[10]];var Action=require(_0xd5bc[11])[_0xd5bc[12]];var ReportMember=require(_0xd5bc[11])[_0xd5bc[13]];var MailServerOut=require(_0xd5bc[11])[_0xd5bc[14]];var MailAccount=require(_0xd5bc[11])[_0xd5bc[15]];var license=require(_0xd5bc[16]);var channels=[_0xd5bc[17],_0xd5bc[18],_0xd5bc[19],_0xd5bc[20]];var router=express.Router();router[_0xd5bc[56]](_0xd5bc[21],function(_0xa5f5x12,_0xa5f5x13,_0xa5f5x14){passport[_0xd5bc[55]](_0xd5bc[22],function(_0xa5f5x15,_0xa5f5x16,_0xa5f5x17){if(_0xa5f5x15){return _0xa5f5x13[_0xd5bc[25]](401)[_0xd5bc[24]]({message:_0xa5f5x15[_0xd5bc[23]]})};if(!_0xa5f5x16){return _0xa5f5x13[_0xd5bc[25]](404)[_0xd5bc[24]](_0xa5f5x17|| {message:_0xd5bc[26]})};return Promise[_0xd5bc[54]]([])[_0xd5bc[34]](function(){if( typeof _0xa5f5x12[_0xd5bc[32]][_0xd5bc[48]]=== _0xd5bc[49]&& _0xa5f5x12[_0xd5bc[32]][_0xd5bc[48]](_0xd5bc[50])&& _0xa5f5x12[_0xd5bc[32]][_0xd5bc[50]]=== false){return};return Action[_0xd5bc[53]]({name:_0xd5bc[51],data1:_0xa5f5x16[_0xd5bc[30]],data2:_0xa5f5x16[_0xd5bc[52]],UserId:_0xa5f5x16[_0xd5bc[30]]})})[_0xd5bc[34]](function(){return User[_0xd5bc[47]](_0xa5f5x16[_0xd5bc[30]])})[_0xd5bc[34]](function(_0xa5f5x16){var _0xa5f5x18={online:true,lastLoginAt:moment()[_0xd5bc[36]](_0xd5bc[35])};if(_0xa5f5x16[_0xd5bc[37]]){_0xa5f5x18[_0xd5bc[38]]= true;_0xa5f5x18[_0xd5bc[39]]= true;_0xa5f5x18[_0xd5bc[40]]= true;_0xa5f5x18[_0xd5bc[41]]= true;_0xa5f5x18[_0xd5bc[42]]= true;_0xa5f5x18[_0xd5bc[43]]= true;_0xa5f5x18[_0xd5bc[44]]= _0xd5bc[45]};return _0xa5f5x16[_0xd5bc[46]](_0xa5f5x18)})[_0xd5bc[34]](function(){return _0xa5f5x13[_0xd5bc[24]]({role:_0xa5f5x16[_0xd5bc[29]],token:auth[_0xd5bc[33]](_0xa5f5x16[_0xd5bc[30]],_0xa5f5x16[_0xd5bc[29]],_0xa5f5x12[_0xd5bc[32]][_0xd5bc[31]]|| false),userId:_0xa5f5x16[_0xd5bc[30]]})})[_0xd5bc[28]](function(_0xa5f5x15){console[_0xd5bc[27]](_0xa5f5x15);return _0xa5f5x14(_0xa5f5x15)})})(_0xa5f5x12,_0xa5f5x13,_0xa5f5x14)});router[_0xd5bc[56]](_0xd5bc[57],function(_0xa5f5x12,_0xa5f5x13,_0xa5f5x14){var _0xa5f5x19,_0xa5f5x1a,_0xa5f5x1b;return User[_0xd5bc[86]]({where:{email:_0xa5f5x12[_0xd5bc[32]][_0xd5bc[65]]}})[_0xd5bc[34]](function(_0xa5f5x16){if(!_0xa5f5x16){throw  new Error(_0xd5bc[85])};_0xa5f5x1a= _0xa5f5x16;return MailAccount[_0xd5bc[86]]({include:[{model:MailServerOut}],where:{service:true}})})[_0xd5bc[34]](function(_0xa5f5x1f){if(!_0xa5f5x1f){throw  new Error(_0xd5bc[82])};_0xa5f5x1b= _0xa5f5x1f[_0xd5bc[14]];return Promise[_0xd5bc[84]](crypto[_0xd5bc[83]])(20)})[_0xd5bc[34]](function(_0xa5f5x1e){_0xa5f5x19= _0xa5f5x1e.toString(_0xd5bc[76]);_0xa5f5x1a[_0xd5bc[77]]= _0xa5f5x19;_0xa5f5x1a[_0xd5bc[78]]= moment()[_0xd5bc[80]](1,_0xd5bc[79]);return _0xa5f5x1a[_0xd5bc[81]]()})[_0xd5bc[34]](function(){var _0xa5f5x1c=nodemailer[_0xd5bc[64]](smtpTransport({host:_0xa5f5x1b[_0xd5bc[59]],port:_0xa5f5x1b[_0xd5bc[60]],secure:_0xa5f5x1b[_0xd5bc[61]],pool:true,auth:{user:_0xa5f5x1b[_0xd5bc[62]],pass:_0xa5f5x1b[_0xd5bc[63]]}}));var _0xa5f5x1d={to:_0xa5f5x1a[_0xd5bc[65]],from:_0xa5f5x1b[_0xd5bc[59]],subject:_0xd5bc[66],text:_0xd5bc[67]+ _0xd5bc[68]+ _0xd5bc[69]+ _0xa5f5x12[_0xd5bc[70]][_0xd5bc[59]]+ _0xd5bc[71]+ _0xa5f5x19+ _0xd5bc[72]+ _0xd5bc[73]+ _0xd5bc[74]};return _0xa5f5x1c[_0xd5bc[75]](_0xa5f5x1d)})[_0xd5bc[34]](function(_0xa5f5x17){_0xa5f5x13[_0xd5bc[58]](200)})[_0xd5bc[28]](function(_0xa5f5x15){return handleError(_0xa5f5x13,_0xa5f5x15)})});router[_0xd5bc[56]](_0xd5bc[87],function(_0xa5f5x12,_0xa5f5x13,_0xa5f5x14){var _0xa5f5x1a,_0xa5f5x1b;return User[_0xd5bc[86]]({where:{resetPasswordToken:_0xa5f5x12[_0xd5bc[96]][_0xd5bc[95]],resetPasswordExpires:{$gt:moment()}}})[_0xd5bc[34]](function(_0xa5f5x16){if(!_0xa5f5x16){throw  new Error(_0xd5bc[92])};var _0xa5f5x20=String(_0xa5f5x12[_0xd5bc[32]][_0xd5bc[63]]);if(!(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[~!@#$%^&\-_=+\[\{\]\}.])[0-9a-zA-Z~!@#$%^&\-_=+\[\{\]\}.]{8,}$/[_0xd5bc[93]](_0xa5f5x20))){throw  new Error(_0xd5bc[94])};_0xa5f5x16[_0xd5bc[63]]= _0xa5f5x20;_0xa5f5x16[_0xd5bc[77]]= null;_0xa5f5x16[_0xd5bc[78]]= null;return _0xa5f5x16[_0xd5bc[81]]()})[_0xd5bc[34]](function(_0xa5f5x16){_0xa5f5x1a= _0xa5f5x16;return MailAccount[_0xd5bc[86]]({include:[{model:MailServerOut}],where:{service:true}})})[_0xd5bc[34]](function(_0xa5f5x1f){if(!_0xa5f5x1f){throw  new Error(_0xd5bc[82])};var _0xa5f5x1c=nodemailer[_0xd5bc[64]](smtpTransport({host:_0xa5f5x1f[_0xd5bc[14]][_0xd5bc[59]],port:_0xa5f5x1f[_0xd5bc[14]][_0xd5bc[60]],secure:_0xa5f5x1f[_0xd5bc[14]][_0xd5bc[61]],pool:true,auth:{user:_0xa5f5x1f[_0xd5bc[14]][_0xd5bc[62]],pass:_0xa5f5x1f[_0xd5bc[14]][_0xd5bc[63]]}}));var _0xa5f5x1d={to:_0xa5f5x1a[_0xd5bc[65]],from:_0xa5f5x1f[_0xd5bc[14]][_0xd5bc[59]],subject:_0xd5bc[88],text:_0xd5bc[89]+ _0xd5bc[90]+ _0xa5f5x1a[_0xd5bc[65]]+ _0xd5bc[91]};return _0xa5f5x1c[_0xd5bc[75]](_0xa5f5x1d)})[_0xd5bc[34]](function(_0xa5f5x17){_0xa5f5x13[_0xd5bc[58]](200)})[_0xd5bc[28]](function(_0xa5f5x15){return handleError(_0xa5f5x13,_0xa5f5x15)})});router[_0xd5bc[102]](_0xd5bc[97],auth[_0xd5bc[98]](),function(_0xa5f5x12,_0xa5f5x13,_0xa5f5x14){return Action[_0xd5bc[53]]({name:_0xd5bc[99],data1:_0xa5f5x12[_0xd5bc[101]][_0xd5bc[30]],data2:_0xa5f5x12[_0xd5bc[101]][_0xd5bc[52]],UserId:_0xa5f5x12[_0xd5bc[101]][_0xd5bc[30]]})[_0xd5bc[34]](function(){_0xa5f5x12[_0xd5bc[99]]();_0xa5f5x13[_0xd5bc[100]](_0xd5bc[21])})[_0xd5bc[28]](function(_0xa5f5x15){return _0xa5f5x14(_0xa5f5x15)})});router[_0xd5bc[102]](_0xd5bc[103],auth[_0xd5bc[98]](),auth[_0xd5bc[105]]([],[_0xd5bc[104],_0xd5bc[101]]),function(_0xa5f5x12,_0xa5f5x13,_0xa5f5x14){return Action[_0xd5bc[53]]({name:_0xd5bc[99],data1:_0xa5f5x12[_0xd5bc[96]][_0xd5bc[30]],UserId:_0xa5f5x12[_0xd5bc[101]][_0xd5bc[30]]})[_0xd5bc[34]](function(){_0xa5f5x13[_0xd5bc[58]](200)})[_0xd5bc[28]](function(_0xa5f5x15){return _0xa5f5x14(_0xa5f5x15)})});function handleError(_0xa5f5x13,_0xa5f5x15){return _0xa5f5x13[_0xd5bc[25]](500)[_0xd5bc[106]]({message:_0xa5f5x15[_0xd5bc[23]]})}module[_0xd5bc[107]]= router