Built motion from commit 3be0d38.|0.0.65
[motion.git] / server / api / user / user.controller.js
1 var _0x6537=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x6F\x64\x75\x6C\x65","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x70\x61\x73\x73\x70\x6F\x72\x74","\x6D\x6F\x6D\x65\x6E\x74","\x6A\x73\x6F\x6E\x77\x65\x62\x74\x6F\x6B\x65\x6E","\x75\x70\x6C\x6F\x61\x64\x2D\x66\x69\x6C\x65","\x70\x61\x74\x68","\x66\x73","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x73\x69\x6D\x70\x6C\x65\x2D\x72\x61\x6E\x64\x6F\x6D","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x75\x73\x65\x72","\x73\x63\x6F\x70\x65","\x67\x65\x74\x55\x73\x65\x72\x73","\x61\x64\x6D\x69\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x63\x72\x65\x61\x74\x65","\x68\x61\x6E\x64\x6C\x65\x55\x6E\x69\x71\x75\x65\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x45\x72\x72\x6F\x72","\x65\x72\x72\x6F\x72\x4D\x61\x6E\x61\x67\x65\x72","\x62\x6F\x64\x79","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x64\x65\x73\x74\x72\x6F\x79","\x6E\x61\x6D\x65","\x68\x61\x6E\x64\x6C\x65\x46\x6F\x72\x65\x69\x67\x6E\x4B\x65\x79\x43\x6F\x6E\x73\x74\x72\x61\x69\x6E\x74\x45\x72\x72\x6F\x72","\x63\x68\x61\x6E\x67\x65\x50\x61\x73\x73\x77\x6F\x72\x64","\x6F\x6C\x64\x50\x61\x73\x73\x77\x6F\x72\x64","\x6E\x65\x77\x50\x61\x73\x73\x77\x6F\x72\x64","\x61\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x73\x61\x76\x65","\x72\x65\x73\x65\x74\x50\x61\x73\x73\x77\x6F\x72\x64","\x63\x68\x61\x6E\x67\x65\x41\x76\x61\x74\x61\x72","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72","\x66\x69\x6C\x65\x73","\x69\x6D\x61\x67\x65\x73","\x6A\x6F\x69\x6E","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x65\x78\x74\x6E\x61\x6D\x65","\x4D\x61\x78\x20\x6E\x75\x6D\x62\x65\x72\x20\x6F\x66\x20\x66\x69\x6C\x65\x73\x20\x75\x70\x6C\x6F\x61\x64\x20\x65\x78\x63\x65\x65\x64\x65\x64","\x4F\x6E\x6C\x79\x20\x6A\x70\x65\x67\x20\x61\x6E\x64\x20\x70\x6E\x67\x20\x66\x6F\x72\x6D\x61\x74\x20\x61\x63\x63\x65\x70\x74\x65\x64","\x49\x6E\x76\x61\x6C\x69\x64\x20\x72\x65\x71\x75\x65\x73\x74","\x65\x6E\x64","\x66\x69\x6C\x65","\x75\x70\x64\x61\x74\x65","\x6F\x6E","\x65\x72\x72\x6F\x72","\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x20\x55\x70\x6C\x6F\x61\x64\x20\x65\x72\x72\x6F\x72\x20\x3A","\x6C\x6F\x67","\x70\x61\x72\x73\x65","\x6D\x65","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x72\x6F\x6C\x65","\x75\x73\x65\x72\x70\x69\x63","\x66\x69\x6E\x64\x4F\x6E\x65","\x67\x65\x74\x41\x76\x61\x74\x61\x72","\x75\x73\x65\x72\x70\x69\x63\x2E\x70\x6E\x67","\x73\x65\x6E\x64\x46\x69\x6C\x65","\x65\x78\x69\x73\x74\x73","\x67\x65\x74\x41\x76\x61\x74\x61\x72\x42\x79\x49\x64","\x76\x69\x73\x69\x74\x6F\x72","\x63\x75\x73\x74\x6F\x6D\x65\x72\x2E\x70\x6E\x67","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x75\x73\x65\x72\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65","\x63\x6F\x75\x6E\x74","\x61\x75\x74\x68\x43\x61\x6C\x6C\x62\x61\x63\x6B","\x2F","\x72\x65\x64\x69\x72\x65\x63\x74"];_0x6537[0];var User=require(_0x6537[2])[_0x6537[1]];var Module=require(_0x6537[2])[_0x6537[3]];var sequelize=require(_0x6537[2])[_0x6537[4]];var config=require(_0x6537[5]);var Util=require(_0x6537[6]);var passport=require(_0x6537[7]);var moment=require(_0x6537[8]);var jwt=require(_0x6537[9]);var uploadFile=require(_0x6537[10]);var path=require(_0x6537[11]);var fs=require(_0x6537[12]);var _=require(_0x6537[13]);var util=require(_0x6537[14]);var sr=require(_0x6537[15]);exports[_0x6537[16]]=function(_0x1764xf,_0x1764x10,_0x1764x11){return User[_0x6537[25]](_0x6537[24])[_0x6537[23]](Util[_0x6537[22]](_0x1764xf[_0x6537[21]]))[_0x6537[20]](function(_0x1764x13){_0x1764x10[_0x6537[19]](200)[_0x6537[18]](_0x1764x13)})[_0x6537[17]](function(_0x1764x12){return handleError(_0x1764x10,_0x1764x12)})};exports[_0x6537[26]]=function(_0x1764xf,_0x1764x10,_0x1764x11){return User[_0x6537[28]]({where:{role:{$in:[_0x6537[27],_0x6537[24],_0x6537[24]]}}})[_0x6537[20]](function(_0x1764x14){return _0x1764x10[_0x6537[19]](200)[_0x6537[18]](_0x1764x14)})[_0x6537[17]](function(_0x1764x12){return handleError(_0x1764x10,_0x1764x12)})};exports[_0x6537[29]]=function(_0x1764xf,_0x1764x10,_0x1764x11){return User[_0x6537[29]](_0x1764xf[_0x6537[32]])[_0x6537[20]](function(_0x1764x15){return _0x1764x10[_0x6537[19]](201)[_0x6537[18]](_0x1764x15)})[_0x6537[17]](sequelize.UniqueConstraintError,function(_0x1764x12){return Util[_0x6537[31]][_0x6537[30]](_0x1764x10,_0x1764x12)})[_0x6537[17]](function(_0x1764x12){return handleError(_0x1764x10,_0x1764x12)})};exports[_0x6537[33]]=function(_0x1764xf,_0x1764x10,_0x1764x11){return User[_0x6537[37]](_0x1764xf[_0x6537[36]][_0x6537[35]])[_0x6537[20]](function(_0x1764x15){if(!_0x1764x15){return _0x1764x10[_0x6537[34]](404)};return _0x1764x10[_0x6537[19]](200)[_0x6537[18]](_0x1764x15)})[_0x6537[17]](function(_0x1764x12){return handleError(_0x1764x10,_0x1764x12)})};exports[_0x6537[38]]=function(_0x1764xf,_0x1764x10,_0x1764x11){var _0x1764x16=_0x1764xf[_0x6537[36]][_0x6537[35]];var _0x1764x17;return User[_0x6537[37]](_0x1764x16)[_0x6537[20]](function(_0x1764x15){_0x1764x17=_0x1764x15;if(!_0x1764x15){return _0x1764x10[_0x6537[34]](404)};return _0x1764x15[_0x6537[38]]()})[_0x6537[20]](function(_0x1764x15){return _0x1764x10[_0x6537[19]](200)[_0x6537[18]](_0x1764x15)})[_0x6537[17]](sequelize.ForeignKeyConstraintError,function(_0x1764x12){return Util[_0x6537[31]][_0x6537[40]](_0x1764x10,_0x6537[24],_0x1764x17[_0x6537[39]],_0x1764x12)})[_0x6537[17]](function(_0x1764x12){return handleError(_0x1764x10,_0x1764x12)})};exports[_0x6537[41]]=function(_0x1764xf,_0x1764x10,_0x1764x11){var _0x1764x16=_0x1764xf[_0x6537[24]][_0x6537[35]];var _0x1764x18=String(_0x1764xf[_0x6537[32]][_0x6537[42]]);var _0x1764x19=String(_0x1764xf[_0x6537[32]][_0x6537[43]]);return User[_0x6537[37]](_0x1764x16)[_0x6537[20]](function(_0x1764x15){if(_0x1764x15[_0x6537[44]](_0x1764x18)){_0x1764x15[_0x6537[45]]=_0x1764x19;_0x1764x15[_0x6537[46]]()[_0x6537[20]](function(){return _0x1764x10[_0x6537[19]](200)[_0x6537[18]](_0x1764x15)})[_0x6537[17]](function(_0x1764x12){return handleError(_0x1764x10,_0x1764x12)})}else {return _0x1764x10[_0x6537[34]](403)}})};exports[_0x6537[47]]=function(_0x1764xf,_0x1764x10,_0x1764x11){var _0x1764x19=String(_0x1764xf[_0x6537[32]][_0x6537[43]]);return User[_0x6537[37]](_0x1764xf[_0x6537[36]][_0x6537[35]])[_0x6537[20]](function(_0x1764x15){_0x1764x15[_0x6537[45]]=_0x1764x19;return _0x1764x15[_0x6537[46]]()})[_0x6537[20]](function(){return _0x1764x10[_0x6537[19]](200)[_0x6537[18]](user)})[_0x6537[17]](function(_0x1764x12){return handleError(_0x1764x10,_0x1764x12)})};exports[_0x6537[48]]=function(_0x1764xf,_0x1764x10,_0x1764x11){var _0x1764x1a= new uploadFile({dest:path[_0x6537[53]](config[_0x6537[49]],_0x6537[50],_0x6537[51],_0x6537[52]),maxNumberOfFiles:1,minNumberOfFiles:0,acceptFileTypes:/(\.|\/)(jpeg|png)$/i,rename:function(_0x1764x1b,_0x1764x1c){return sr()+path[_0x6537[55]](_0x1764x1c[_0x6537[54]])},messages:{maxNumberOfFiles:_0x6537[56],acceptFileTypes:_0x6537[57],invalidRequest:_0x6537[58]}});_0x1764x1a[_0x6537[62]](_0x6537[59],function(_0x1764x1d,_0x1764x1e){if(!_0x1764x1e[_0x6537[60]][_0x6537[54]]){return _0x1764x10[_0x6537[19]](500)[_0x6537[18]](_0x1764x1a)};return User[_0x6537[37]](_0x1764xf[_0x6537[36]][_0x6537[35]])[_0x6537[20]](function(_0x1764x15){if(!_0x1764x15){return _0x1764x10[_0x6537[34]](404)};return _0x1764x15[_0x6537[61]]({userpic:_0x1764x1e[_0x6537[60]][_0x6537[54]]})})[_0x6537[20]](function(_0x1764x15){return _0x1764x10[_0x6537[19]](200)[_0x6537[18]](_0x1764x15)})[_0x6537[17]](function(_0x1764x12){return handleError(_0x1764x10,_0x1764x12)})});_0x1764x1a[_0x6537[62]](_0x6537[63],function(_0x1764x12){console[_0x6537[65]](_0x6537[64],_0x1764x12);return handleError(_0x1764x10,_0x1764x12)});_0x1764x1a[_0x6537[66]](_0x1764xf)};exports[_0x6537[67]]=function(_0x1764xf,_0x1764x10,_0x1764x11){var _0x1764x16=_0x1764xf[_0x6537[24]][_0x6537[35]];return User[_0x6537[72]]({where:{id:_0x1764x16},attributes:[_0x6537[35],_0x6537[68],_0x6537[39],_0x6537[69],_0x6537[70],_0x6537[71]],include:[Module]})[_0x6537[20]](function(_0x1764x15){if(!_0x1764x15){return _0x1764x10[_0x6537[34]](401)};return _0x1764x10[_0x6537[19]](200)[_0x6537[18]](_0x1764x15)})[_0x6537[17]](function(_0x1764x12){return handleError(_0x1764x10,_0x1764x12)})};exports[_0x6537[61]]=function(_0x1764xf,_0x1764x10,_0x1764x11){var _0x1764x16=_0x1764xf[_0x6537[24]][_0x6537[35]];delete _0x1764xf[_0x6537[32]][_0x6537[45]];return User[_0x6537[37]](_0x1764xf[_0x6537[36]][_0x6537[35]])[_0x6537[20]](function(_0x1764x15){if(!_0x1764x15){return _0x1764x10[_0x6537[34]](500)};return _0x1764x15[_0x6537[61]](_0x1764xf[_0x6537[32]])})[_0x6537[20]](function(_0x1764x15){return _0x1764x10[_0x6537[19]](200)[_0x6537[18]](_0x1764x15)})[_0x6537[17]](function(_0x1764x12){return handleError(_0x1764x10,_0x1764x12)})};exports[_0x6537[73]]=function(_0x1764xf,_0x1764x10,_0x1764x11){var _0x1764x1f=path[_0x6537[53]](config[_0x6537[49]],_0x6537[50],_0x6537[51],_0x6537[52],_0x1764xf[_0x6537[36]][_0x6537[54]]);fs[_0x6537[76]](_0x1764x1f,function(_0x1764x20){if(!_0x1764x20){_0x1764x1f=path[_0x6537[53]](config[_0x6537[49]],_0x6537[50],_0x6537[51],_0x6537[52],_0x6537[74])};return _0x1764x10[_0x6537[75]](_0x1764x1f)})};exports[_0x6537[77]]=function(_0x1764xf,_0x1764x10,_0x1764x11){if(_0x1764xf[_0x6537[36]][_0x6537[35]]===_0x6537[78]){var _0x1764x1f=path[_0x6537[53]](config[_0x6537[49]],_0x6537[50],_0x6537[51],_0x6537[52],_0x6537[79]);fs[_0x6537[76]](_0x1764x1f,function(_0x1764x20){return _0x1764x10[_0x6537[75]](_0x1764x1f)})}else {return User[_0x6537[37]](_0x1764xf[_0x6537[36]][_0x6537[35]])[_0x6537[20]](function(_0x1764x15){if(_0x1764x15){var _0x1764x1f=path[_0x6537[53]](config[_0x6537[49]],_0x6537[50],_0x6537[51],_0x6537[52],_0x1764x15[_0x6537[71]]?_0x1764x15[_0x6537[71]]:_0x6537[74]);fs[_0x6537[76]](_0x1764x1f,function(_0x1764x20){if(!_0x1764x20){_0x1764x1f=path[_0x6537[53]](config[_0x6537[49]],_0x6537[50],_0x6537[51],_0x6537[52],_0x6537[74])};return _0x1764x10[_0x6537[75]](_0x1764x1f)})}else {return _0x1764x10[_0x6537[34]](500)}})[_0x6537[17]](function(_0x1764x12){return handleError(_0x1764x10,_0x1764x12)})}};exports[_0x6537[80]]=function(_0x1764xf,_0x1764x10){return User[_0x6537[38]]({where:{id:_0x1764xf[_0x6537[21]][_0x6537[35]]},individualHooks:true})[_0x6537[20]](function(){return _0x1764x10[_0x6537[34]](204)})[_0x6537[17]](function(_0x1764x12){return handleError(_0x1764x10,_0x1764x12)})};exports[_0x6537[81]]=function(_0x1764xf,_0x1764x10){var _0x1764x21={};_0x1764x21[_0x1764xf[_0x6537[36]][_0x6537[82]]]=_0x1764xf[_0x6537[32]][_0x6537[83]];return User[_0x6537[23]]({where:_0x1764x21})[_0x6537[20]](function(_0x1764x13){if(_0x1764x13[_0x6537[84]]){return _0x1764x10[_0x6537[19]](200)[_0x6537[18]]({isValid:false,value:_0x1764xf[_0x6537[32]][_0x6537[83]]})};return _0x1764x10[_0x6537[19]](200)[_0x6537[18]]({isValid:true,value:_0x1764xf[_0x6537[32]][_0x6537[83]]})})[_0x6537[17]](function(_0x1764x12){return handleError(_0x1764x10,_0x1764x12)})};exports[_0x6537[85]]=function(_0x1764xf,_0x1764x10,_0x1764x11){_0x1764x10[_0x6537[87]](_0x6537[86])};function handleError(_0x1764x10,_0x1764x12){return _0x1764x10[_0x6537[19]](500)[_0x6537[18]](_0x1764x12)}