1 var _0x7967=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x70\x61\x73\x73\x70\x6F\x72\x74","\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x6A\x73\x6F\x6E\x77\x65\x62\x74\x6F\x6B\x65\x6E","\x65\x78\x70\x72\x65\x73\x73\x2D\x6A\x77\x74","\x63\x6F\x6D\x70\x6F\x73\x61\x62\x6C\x65\x2D\x6D\x69\x64\x64\x6C\x65\x77\x61\x72\x65","\x55\x73\x65\x72","\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4C\x69\x73\x74","\x73\x65\x63\x72\x65\x74","\x73\x65\x73\x73\x69\x6F\x6E","\x62\x6C\x75\x65\x62\x69\x72\x64","\x6C\x6F\x64\x61\x73\x68","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x75\x73\x65\x72","\x74\x68\x65\x6E","\x69\x64","\x66\x69\x6E\x64\x42\x79\x49\x64","\x75\x73\x65","\x71\x75\x65\x72\x79","\x61\x63\x63\x65\x73\x73\x5F\x74\x6F\x6B\x65\x6E","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x61\x75\x74\x68\x6F\x72\x69\x7A\x61\x74\x69\x6F\x6E","\x68\x65\x61\x64\x65\x72\x73","\x42\x65\x61\x72\x65\x72\x20","\x42\x61\x73\x69\x63","\x73\x74\x61\x72\x74\x73\x57\x69\x74\x68","\x20","\x73\x70\x6C\x69\x74","\x61\x73\x63\x69\x69","\x62\x61\x73\x65\x36\x34","\x3A","\x61\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x57\x72\x6F\x6E\x67\x20\x63\x72\x65\x64\x65\x6E\x74\x69\x61\x6C\x73\x2E","\x66\x69\x6E\x64\x4F\x6E\x65","\x72\x65\x64\x75\x63\x65","\x72\x6F\x6C\x65","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x68\x61\x73\x4D\x6F\x64\x75\x6C\x65","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x61\x6C\x6C","\x52\x65\x71\x75\x69\x72\x65\x64\x20\x72\x6F\x6C\x65\x20\x6E\x65\x65\x64\x73\x20\x74\x6F\x20\x62\x65\x20\x73\x65\x74","\x69\x6E\x64\x65\x78\x4F\x66","\x75\x73\x65\x72\x52\x6F\x6C\x65\x73","\x31\x64","\x73\x69\x67\x6E","\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","\x6A\x73\x6F\x6E","\x74\x6F\x6B\x65\x6E","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x63\x6F\x6F\x6B\x69\x65","\x2F","\x72\x65\x64\x69\x72\x65\x63\x74","\x69\x73\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65\x64","\x68\x61\x73\x52\x6F\x6C\x65","\x73\x69\x67\x6E\x54\x6F\x6B\x65\x6E","\x73\x65\x74\x54\x6F\x6B\x65\x6E\x43\x6F\x6F\x6B\x69\x65"];_0x7967[0];var passport=require(_0x7967[1]);var config=require(_0x7967[2]);var jwt=require(_0x7967[3]);var expressJwt=require(_0x7967[4]);var compose=require(_0x7967[5]);var User=require(_0x7967[7])[_0x7967[6]];var List=require(_0x7967[7])[_0x7967[8]];var validateJwt=expressJwt({secret:config[_0x7967[10]][_0x7967[9]]});var Promise=require(_0x7967[11]);var _=require(_0x7967[12]);function isAuthenticated(){return compose()[_0x7967[19]](function(_0xdbd6xc,_0xdbd6xd,_0xdbd6xe){if(_0xdbd6xc[_0x7967[20]]&&_0xdbd6xc[_0x7967[20]][_0x7967[22]](_0x7967[21])){_0xdbd6xc[_0x7967[24]][_0x7967[23]]=_0x7967[25]+_0xdbd6xc[_0x7967[20]][_0x7967[21]]};if(_0xdbd6xc[_0x7967[24]]&&_0xdbd6xc[_0x7967[24]][_0x7967[23]]&&_[_0x7967[27]](_0xdbd6xc[_0x7967[24]][_0x7967[23]],_0x7967[26])){var _0xdbd6x11=_[_0x7967[29]](_0xdbd6xc[_0x7967[24]][_0x7967[23]],_0x7967[28]);var _0xdbd6x12= new Buffer(_0xdbd6x11[1],_0x7967[31]).toString(_0x7967[30]);var _0xdbd6x13=_[_0x7967[29]](_0xdbd6x12,_0x7967[32])[0];var _0xdbd6x14=_[_0x7967[29]](_0xdbd6x12,_0x7967[32])[1];return User[_0x7967[35]]({where:{name:_0xdbd6x13}})[_0x7967[16]](function(_0xdbd6x10){if(!_0xdbd6x10||!_0xdbd6x10[_0x7967[33]](_0xdbd6x14)){_0xdbd6xe( new Error(_0x7967[34]))};_0xdbd6xc[_0x7967[15]]={id:_0xdbd6x10[_0x7967[17]]};_0xdbd6xe()})}else {validateJwt(_0xdbd6xc,_0xdbd6xd,_0xdbd6xe)}})[_0x7967[19]](function(_0xdbd6xc,_0xdbd6xd,_0xdbd6xe){User[_0x7967[18]](_0xdbd6xc[_0x7967[15]][_0x7967[17]],{include:[{model:List}]})[_0x7967[16]](function(_0xdbd6x10){if(!_0xdbd6x10){return _0xdbd6xd[_0x7967[14]](401)};_0xdbd6xc[_0x7967[15]]=_0xdbd6x10;return _0xdbd6xe()})[_0x7967[13]](function(_0xdbd6xf){return _0xdbd6xe(_0xdbd6xf)})})}function hasModule(_0xdbd6x16,_0xdbd6x17){return compose()[_0x7967[19]](function(_0xdbd6xc,_0xdbd6xd,_0xdbd6xe){return User[_0x7967[18]](_0xdbd6xc[_0x7967[15]][_0x7967[17]])[_0x7967[16]](function(_0xdbd6x10){var _0xdbd6x1b=[];_0xdbd6x16[_0x7967[41]](function(_0xdbd6x1c){_0xdbd6x1b[_0x7967[40]](_0xdbd6x10[_0x7967[39]](_0xdbd6x1c))});return Promise[_0x7967[42]](_0xdbd6x1b)})[_0x7967[16]](function(_0xdbd6x18){var hasModule=(_[_0x7967[36]](_0xdbd6x18,function(_0xdbd6x19,_0xdbd6x1a){return _0xdbd6x19||_0xdbd6x1a}));if(_[_0x7967[38]](_0xdbd6x17,_0xdbd6xc[_0x7967[15]][_0x7967[37]])||hasModule){return _0xdbd6xe()}else {_0xdbd6xd[_0x7967[14]](403)}})[_0x7967[13]](function(_0xdbd6xf){return _0xdbd6xe(_0xdbd6xf)})})}function hasRole(_0xdbd6x1e){if(!_0xdbd6x1e){throw new Error(_0x7967[43])};return compose()[_0x7967[19]](isAuthenticated())[_0x7967[19]](function _0xdbd6x1f(_0xdbd6xc,_0xdbd6xd,_0xdbd6xe){if(config[_0x7967[45]][_0x7967[44]](_0xdbd6xc[_0x7967[15]][_0x7967[37]])>=config[_0x7967[45]][_0x7967[44]](_0xdbd6x1e)){return _0xdbd6xe()}else {return _0xdbd6xd[_0x7967[14]](403)}})}function signToken(_0xdbd6x21,_0xdbd6x22,_0xdbd6x23){var _0xdbd6x24=60*24*365*5;if(!_0xdbd6x23){_0xdbd6x24=_0x7967[46]};return jwt[_0x7967[47]]({id:_0xdbd6x21},config[_0x7967[10]][_0x7967[9]],{expiresIn:_0xdbd6x24})}function setTokenCookie(_0xdbd6xc,_0xdbd6xd){if(!_0xdbd6xc[_0x7967[15]]){return _0xdbd6xd[_0x7967[49]](404,{message:_0x7967[48]})};var _0xdbd6x26=signToken(_0xdbd6xc[_0x7967[15]][_0x7967[17]],_0xdbd6xc[_0x7967[15]][_0x7967[37]]);_0xdbd6xd[_0x7967[52]](_0x7967[50],JSON[_0x7967[51]](_0xdbd6x26));_0xdbd6xd[_0x7967[54]](_0x7967[53])}exports[_0x7967[55]]=isAuthenticated;exports[_0x7967[56]]=hasRole;exports[_0x7967[39]]=hasModule;exports[_0x7967[57]]=signToken;exports[_0x7967[58]]=setTokenCookie