Built motion from commit eae4cb9.|0.0.78
[motion.git] / server / api / user / user.controller.js
1 var _0xce26=["\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"];_0xce26[0];var User=require(_0xce26[2])[_0xce26[1]];var Module=require(_0xce26[2])[_0xce26[3]];var sequelize=require(_0xce26[2])[_0xce26[4]];var config=require(_0xce26[5]);var Util=require(_0xce26[6]);var passport=require(_0xce26[7]);var moment=require(_0xce26[8]);var jwt=require(_0xce26[9]);var uploadFile=require(_0xce26[10]);var path=require(_0xce26[11]);var fs=require(_0xce26[12]);var _=require(_0xce26[13]);var util=require(_0xce26[14]);var sr=require(_0xce26[15]);exports[_0xce26[16]]=function(_0xf983xf,_0xf983x10,_0xf983x11){return User[_0xce26[25]](_0xce26[24])[_0xce26[23]](Util[_0xce26[22]](_0xf983xf[_0xce26[21]]))[_0xce26[20]](function(_0xf983x13){_0xf983x10[_0xce26[19]](200)[_0xce26[18]](_0xf983x13)})[_0xce26[17]](function(_0xf983x12){return handleError(_0xf983x10,_0xf983x12)})};exports[_0xce26[26]]=function(_0xf983xf,_0xf983x10,_0xf983x11){return User[_0xce26[28]]({where:{role:{$in:[_0xce26[27],_0xce26[24],_0xce26[24]]}}})[_0xce26[20]](function(_0xf983x14){return _0xf983x10[_0xce26[19]](200)[_0xce26[18]](_0xf983x14)})[_0xce26[17]](function(_0xf983x12){return handleError(_0xf983x10,_0xf983x12)})};exports[_0xce26[29]]=function(_0xf983xf,_0xf983x10,_0xf983x11){return User[_0xce26[29]](_0xf983xf[_0xce26[32]])[_0xce26[20]](function(_0xf983x15){return _0xf983x10[_0xce26[19]](201)[_0xce26[18]](_0xf983x15)})[_0xce26[17]](sequelize.UniqueConstraintError,function(_0xf983x12){return Util[_0xce26[31]][_0xce26[30]](_0xf983x10,_0xf983x12)})[_0xce26[17]](function(_0xf983x12){return handleError(_0xf983x10,_0xf983x12)})};exports[_0xce26[33]]=function(_0xf983xf,_0xf983x10,_0xf983x11){return User[_0xce26[37]](_0xf983xf[_0xce26[36]][_0xce26[35]])[_0xce26[20]](function(_0xf983x15){if(!_0xf983x15){return _0xf983x10[_0xce26[34]](404)};return _0xf983x10[_0xce26[19]](200)[_0xce26[18]](_0xf983x15)})[_0xce26[17]](function(_0xf983x12){return handleError(_0xf983x10,_0xf983x12)})};exports[_0xce26[38]]=function(_0xf983xf,_0xf983x10,_0xf983x11){var _0xf983x16=_0xf983xf[_0xce26[36]][_0xce26[35]];var _0xf983x17;return User[_0xce26[37]](_0xf983x16)[_0xce26[20]](function(_0xf983x15){_0xf983x17=_0xf983x15;if(!_0xf983x15){return _0xf983x10[_0xce26[34]](404)};return _0xf983x15[_0xce26[38]]()})[_0xce26[20]](function(_0xf983x15){return _0xf983x10[_0xce26[19]](200)[_0xce26[18]](_0xf983x15)})[_0xce26[17]](sequelize.ForeignKeyConstraintError,function(_0xf983x12){return Util[_0xce26[31]][_0xce26[40]](_0xf983x10,_0xce26[24],_0xf983x17[_0xce26[39]],_0xf983x12)})[_0xce26[17]](function(_0xf983x12){return handleError(_0xf983x10,_0xf983x12)})};exports[_0xce26[41]]=function(_0xf983xf,_0xf983x10,_0xf983x11){var _0xf983x16=_0xf983xf[_0xce26[24]][_0xce26[35]];var _0xf983x18=String(_0xf983xf[_0xce26[32]][_0xce26[42]]);var _0xf983x19=String(_0xf983xf[_0xce26[32]][_0xce26[43]]);return User[_0xce26[37]](_0xf983x16)[_0xce26[20]](function(_0xf983x15){if(_0xf983x15[_0xce26[44]](_0xf983x18)){_0xf983x15[_0xce26[45]]=_0xf983x19;_0xf983x15[_0xce26[46]]()[_0xce26[20]](function(){return _0xf983x10[_0xce26[34]](200)})[_0xce26[17]](function(_0xf983x12){return handleError(_0xf983x10,_0xf983x12)})}else {return _0xf983x10[_0xce26[34]](403)}})};exports[_0xce26[47]]=function(_0xf983xf,_0xf983x10,_0xf983x11){var _0xf983x19=String(_0xf983xf[_0xce26[32]][_0xce26[43]]);return User[_0xce26[37]](_0xf983xf[_0xce26[36]][_0xce26[35]])[_0xce26[20]](function(_0xf983x15){_0xf983x15[_0xce26[45]]=_0xf983x19;return _0xf983x15[_0xce26[46]]()})[_0xce26[20]](function(){return _0xf983x10[_0xce26[34]](200)})[_0xce26[17]](function(_0xf983x12){return handleError(_0xf983x10,_0xf983x12)})};exports[_0xce26[48]]=function(_0xf983xf,_0xf983x10,_0xf983x11){var _0xf983x1a= new uploadFile({dest:path[_0xce26[53]](config[_0xce26[49]],_0xce26[50],_0xce26[51],_0xce26[52]),maxNumberOfFiles:1,minNumberOfFiles:0,acceptFileTypes:/(\.|\/)(jpeg|png)$/i,rename:function(_0xf983x1b,_0xf983x1c){return sr()+path[_0xce26[55]](_0xf983x1c[_0xce26[54]])},messages:{maxNumberOfFiles:_0xce26[56],acceptFileTypes:_0xce26[57],invalidRequest:_0xce26[58]}});_0xf983x1a[_0xce26[62]](_0xce26[59],function(_0xf983x1d,_0xf983x1e){if(!_0xf983x1e[_0xce26[60]][_0xce26[54]]){return _0xf983x10[_0xce26[19]](500)[_0xce26[18]](_0xf983x1a)};return User[_0xce26[37]](_0xf983xf[_0xce26[36]][_0xce26[35]])[_0xce26[20]](function(_0xf983x15){if(!_0xf983x15){return _0xf983x10[_0xce26[34]](404)};return _0xf983x15[_0xce26[61]]({userpic:_0xf983x1e[_0xce26[60]][_0xce26[54]]})})[_0xce26[20]](function(_0xf983x15){return _0xf983x10[_0xce26[19]](200)[_0xce26[18]](_0xf983x15)})[_0xce26[17]](function(_0xf983x12){return handleError(_0xf983x10,_0xf983x12)})});_0xf983x1a[_0xce26[62]](_0xce26[63],function(_0xf983x12){console[_0xce26[65]](_0xce26[64],_0xf983x12);return handleError(_0xf983x10,_0xf983x12)});_0xf983x1a[_0xce26[66]](_0xf983xf)};exports[_0xce26[67]]=function(_0xf983xf,_0xf983x10,_0xf983x11){var _0xf983x16=_0xf983xf[_0xce26[24]][_0xce26[35]];return User[_0xce26[72]]({where:{id:_0xf983x16},attributes:[_0xce26[35],_0xce26[68],_0xce26[39],_0xce26[69],_0xce26[70],_0xce26[71]],include:[Module]})[_0xce26[20]](function(_0xf983x15){if(!_0xf983x15){return _0xf983x10[_0xce26[34]](401)};return _0xf983x10[_0xce26[19]](200)[_0xce26[18]](_0xf983x15)})[_0xce26[17]](function(_0xf983x12){return handleError(_0xf983x10,_0xf983x12)})};exports[_0xce26[61]]=function(_0xf983xf,_0xf983x10,_0xf983x11){var _0xf983x16=_0xf983xf[_0xce26[24]][_0xce26[35]];delete _0xf983xf[_0xce26[32]][_0xce26[45]];return User[_0xce26[37]](_0xf983xf[_0xce26[36]][_0xce26[35]])[_0xce26[20]](function(_0xf983x15){if(!_0xf983x15){return _0xf983x10[_0xce26[34]](500)};return _0xf983x15[_0xce26[61]](_0xf983xf[_0xce26[32]])})[_0xce26[20]](function(_0xf983x15){return _0xf983x10[_0xce26[19]](200)[_0xce26[18]](_0xf983x15)})[_0xce26[17]](function(_0xf983x12){return handleError(_0xf983x10,_0xf983x12)})};exports[_0xce26[73]]=function(_0xf983xf,_0xf983x10,_0xf983x11){var _0xf983x1f=path[_0xce26[53]](config[_0xce26[49]],_0xce26[50],_0xce26[51],_0xce26[52],_0xf983xf[_0xce26[36]][_0xce26[54]]);fs[_0xce26[76]](_0xf983x1f,function(_0xf983x20){if(!_0xf983x20){_0xf983x1f=path[_0xce26[53]](config[_0xce26[49]],_0xce26[50],_0xce26[51],_0xce26[52],_0xce26[74])};return _0xf983x10[_0xce26[75]](_0xf983x1f)})};exports[_0xce26[77]]=function(_0xf983xf,_0xf983x10,_0xf983x11){if(_0xf983xf[_0xce26[36]][_0xce26[35]]===_0xce26[78]){var _0xf983x1f=path[_0xce26[53]](config[_0xce26[49]],_0xce26[50],_0xce26[51],_0xce26[52],_0xce26[79]);fs[_0xce26[76]](_0xf983x1f,function(_0xf983x20){return _0xf983x10[_0xce26[75]](_0xf983x1f)})}else {return User[_0xce26[37]](_0xf983xf[_0xce26[36]][_0xce26[35]])[_0xce26[20]](function(_0xf983x15){if(_0xf983x15){var _0xf983x1f=path[_0xce26[53]](config[_0xce26[49]],_0xce26[50],_0xce26[51],_0xce26[52],_0xf983x15[_0xce26[71]]?_0xf983x15[_0xce26[71]]:_0xce26[74]);fs[_0xce26[76]](_0xf983x1f,function(_0xf983x20){if(!_0xf983x20){_0xf983x1f=path[_0xce26[53]](config[_0xce26[49]],_0xce26[50],_0xce26[51],_0xce26[52],_0xce26[74])};return _0xf983x10[_0xce26[75]](_0xf983x1f)})}else {return _0xf983x10[_0xce26[34]](500)}})[_0xce26[17]](function(_0xf983x12){return handleError(_0xf983x10,_0xf983x12)})}};exports[_0xce26[80]]=function(_0xf983xf,_0xf983x10){return User[_0xce26[38]]({where:{id:_0xf983xf[_0xce26[21]][_0xce26[35]]},individualHooks:true})[_0xce26[20]](function(){return _0xf983x10[_0xce26[34]](204)})[_0xce26[17]](function(_0xf983x12){return handleError(_0xf983x10,_0xf983x12)})};exports[_0xce26[81]]=function(_0xf983xf,_0xf983x10){var _0xf983x21={};_0xf983x21[_0xf983xf[_0xce26[36]][_0xce26[82]]]=_0xf983xf[_0xce26[32]][_0xce26[83]];return User[_0xce26[23]]({where:_0xf983x21})[_0xce26[20]](function(_0xf983x13){if(_0xf983x13[_0xce26[84]]){return _0xf983x10[_0xce26[19]](200)[_0xce26[18]]({isValid:false,value:_0xf983xf[_0xce26[32]][_0xce26[83]]})};return _0xf983x10[_0xce26[19]](200)[_0xce26[18]]({isValid:true,value:_0xf983xf[_0xce26[32]][_0xce26[83]]})})[_0xce26[17]](function(_0xf983x12){return handleError(_0xf983x10,_0xf983x12)})};exports[_0xce26[85]]=function(_0xf983xf,_0xf983x10,_0xf983x11){_0xf983x10[_0xce26[87]](_0xce26[86])};function handleError(_0xf983x10,_0xf983x12){return _0xf983x10[_0xce26[19]](500)[_0xce26[18]](_0xf983x12)}