Built motion from commit 17d0c2b.|2.0.0
[motion2.git] / server / api / user / user.model.js
1 var _0xc512=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x63\x72\x79\x70\x74\x6F","\x75\x74\x69\x6C","\x6D\x64\x35","\x2E\x2F\x75\x73\x65\x72\x2E\x61\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x67\x6F\x6F\x67\x6C\x65","\x6C\x65\x6E\x67\x74\x68","\x65\x78\x70\x6F\x72\x74\x73","\x55\x73\x65\x72","\x75\x73\x65\x72\x73","\x75\x70\x64\x61\x74\x65\x4D\x64\x35\x50\x61\x73\x73\x77\x6F\x72\x64","\x75\x70\x64\x61\x74\x65\x50\x61\x73\x73\x77\x6F\x72\x64","\x66\x6F\x72\x45\x61\x63\x68","\x70\x61\x73\x73\x77\x6F\x72\x64","\x63\x68\x61\x6E\x67\x65\x64","\x66\x72\x6F\x6D\x2D\x73\x69\x70","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x2D\x2D","\x44\x69\x61\x6C","\x53\x49\x50\x2F\x25\x73\x2C\x2C\x74\x54\x78\x58","\x6E\x61\x6D\x65","\x66\x6F\x72\x6D\x61\x74","\x73\x79\x73\x74\x65\x6D","\x69\x64","\x63\x68\x61\x6E\x73\x70\x79","\x25\x73\x25\x73","\x70\x72\x65\x66\x69\x78","\x53\x65\x74","\x43\x44\x52\x28\x74\x79\x70\x65\x29\x3D\x63\x68\x61\x6E\x73\x70\x79","\x70\x75\x73\x68","\x72\x65\x63\x6F\x72\x64","\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","\x24\x7B\x55\x4E\x49\x51\x55\x45\x49\x44\x7D\x2E\x25\x73","\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x46\x6F\x72\x6D\x61\x74","\x61\x75\x74\x68","\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x43\x68\x61\x6E\x53\x70\x79","\x53\x49\x50\x2F\x25\x73\x2C\x25\x73","\x6F\x70\x74\x69\x6F\x6E\x73","\x53\x74\x6F\x70\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x6D\x6F\x64\x65\x6C\x73","\x66\x69\x6E\x64\x41\x6C\x6C","\x56\x6F\x69\x63\x65\x43\x68\x61\x6E\x53\x70\x79","\x64\x65\x73\x74\x72\x6F\x79","\x65\x6E\x63\x72\x79\x70\x74\x50\x61\x73\x73\x77\x6F\x72\x64","\x66\x75\x6E\x63\x74\x69\x6F\x6E","\x4D\x69\x73\x73\x69\x6E\x67\x20\x43\x61\x6C\x6C\x62\x61\x63\x6B","\x62\x61\x73\x65\x36\x34","\x72\x61\x6E\x64\x6F\x6D\x42\x79\x74\x65\x73","\x73\x61\x6C\x74","\x70\x62\x6B\x64\x66\x32\x53\x79\x6E\x63","\x70\x62\x6B\x64\x66\x32","\x70\x72\x6F\x76\x69\x64\x65\x72","\x69\x6E\x64\x65\x78\x4F\x66","\x49\x6E\x76\x61\x6C\x69\x64\x20\x70\x61\x73\x73\x77\x6F\x72\x64","\x6D\x61\x6B\x65\x53\x61\x6C\x74","\x6D\x64\x35\x73\x65\x63\x72\x65\x74","\x3A\x61\x73\x74\x65\x72\x69\x73\x6B\x3A","\x64\x65\x66\x69\x6E\x65"];_0xc512[0];var crypto=require(_0xc512[1]);var util=require(_0xc512[2]);var md5=require(_0xc512[3]);var attributes=require(_0xc512[4]);var authTypes=[_0xc512[5]];var validatePresenceOf=function(_0x28f7x7){return _0x28f7x7&& _0x28f7x7[_0xc512[6]]};module[_0xc512[7]]= function(_0x28f7x8,_0x28f7x9){return _0x28f7x8[_0xc512[62]](_0xc512[8],attributes,{tableName:_0xc512[9],hooks:{beforeBulkCreate:function(_0x28f7xa,_0x28f7xb,_0x28f7xc){var _0x28f7xd=0;_0x28f7xa[_0xc512[12]](function(_0x28f7xe){_0x28f7xe[_0xc512[10]]();_0x28f7xe[_0xc512[11]](function(_0x28f7xf){if(_0x28f7xf){return _0x28f7xc(_0x28f7xf)};_0x28f7xd+= 1;if(_0x28f7xd=== _0x28f7xa[_0xc512[6]]){return _0x28f7xc()}})})},beforeCreate:function(_0x28f7xe,_0x28f7xb,_0x28f7xc){_0x28f7xe[_0xc512[10]]();_0x28f7xe[_0xc512[11]](_0x28f7xc)},beforeUpdate:function(_0x28f7xe,_0x28f7xb,_0x28f7xc){if(_0x28f7xe[_0xc512[14]](_0xc512[13])){_0x28f7xe[_0xc512[10]]();return _0x28f7xe[_0xc512[11]](_0x28f7xc)};_0x28f7xc()},afterCreate:function(_0x28f7xe,_0x28f7xb,_0x28f7xc){var _0x28f7x10=[{context:_0xc512[15],exten:_0x28f7xe[_0xc512[16]],priority:1,tag:_0xc512[17],app:_0xc512[18],appdata:util[_0xc512[21]](_0xc512[19],_0x28f7xe[_0xc512[20]]),type:_0xc512[22],isApp:false,cutdigits:0,UserId:_0x28f7xe[_0xc512[23]]},{context:_0xc512[15],exten:_0x28f7xe[_0xc512[20]],priority:1,tag:_0xc512[17],app:_0xc512[18],appdata:util[_0xc512[21]](_0xc512[19],_0x28f7xe[_0xc512[20]]),type:_0xc512[22],isApp:false,cutdigits:0,UserId:_0x28f7xe[_0xc512[23]]}];return _0x28f7x8[_0xc512[44]][_0xc512[46]][_0xc512[45]]()[_0xc512[41]](function(_0x28f7x11){for(var _0x28f7x12=0,_0x28f7x13=1;_0x28f7x12< _0x28f7x11[_0xc512[6]];_0x28f7x12++,_0x28f7x13= 1){if(_0x28f7xe[_0xc512[24]]){_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[20]]),priority:_0x28f7x13,app:_0xc512[27],appdata:_0xc512[28],UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]});_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[16]]),priority:_0x28f7x13++,app:_0xc512[27],appdata:_0xc512[28],UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]});if(_0x28f7x11[_0x28f7x12][_0xc512[30]]){_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[20]]),priority:_0x28f7x13,app:_0xc512[31],appdata:util[_0xc512[21]](_0xc512[32],_0x28f7x11[_0x28f7x12][_0xc512[33]]),UserId:_0x28f7x11[_0x28f7x12][_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]});_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[16]]),priority:_0x28f7x13++,app:_0xc512[31],appdata:util[_0xc512[21]](_0xc512[32],_0x28f7x11[_0x28f7x12][_0xc512[33]]),UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]})};if(_0x28f7x11[_0x28f7x12][_0xc512[34]]){_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[20]]),priority:_0x28f7x13,app:_0xc512[35],appdata:_0x28f7x11[_0x28f7x12][_0xc512[13]],UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]});_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[16]]),priority:_0x28f7x13++,app:_0xc512[35],appdata:_0x28f7x11[_0x28f7x12][_0xc512[13]],UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]})};_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[20]]),priority:_0x28f7x13,app:_0xc512[36],appdata:util[_0xc512[21]](_0xc512[37],_0x28f7xe[_0xc512[20]],_0x28f7x11[_0x28f7x12][_0xc512[38]]),UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]});_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[16]]),priority:_0x28f7x13,app:_0xc512[36],appdata:util[_0xc512[21]](_0xc512[37],_0x28f7xe[_0xc512[20]],_0x28f7x11[_0x28f7x12][_0xc512[38]]),UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]});if(_0x28f7x11[_0x28f7x12][_0xc512[30]]){_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[20]]),priority:_0x28f7x13,app:_0xc512[39],UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]});_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[16]]),priority:_0x28f7x13++,app:_0xc512[39],UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]})}}};return _0x28f7x8[_0xc512[44]][_0xc512[43]][_0xc512[42]](_0x28f7x10)[_0xc512[41]](function(){_0x28f7xc()})[_0xc512[40]](function(_0x28f7xf){_0x28f7xc(_0x28f7xf)})})},afterUpdate:function(_0x28f7xe,_0x28f7xb,_0x28f7xc){if(_0x28f7xe[_0xc512[14]](_0xc512[24])){if(_0x28f7xe[_0xc512[24]]){var _0x28f7x10=[];return _0x28f7x8[_0xc512[44]][_0xc512[46]][_0xc512[45]]()[_0xc512[41]](function(_0x28f7x11){for(var _0x28f7x12=0,_0x28f7x13=1;_0x28f7x12< _0x28f7x11[_0xc512[6]];_0x28f7x12++,_0x28f7x13= 1){_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[20]]),priority:_0x28f7x13,app:_0xc512[27],appdata:_0xc512[28],UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]});_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[16]]),priority:_0x28f7x13++,app:_0xc512[27],appdata:_0xc512[28],UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]});if(_0x28f7x11[_0x28f7x12][_0xc512[30]]){_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[20]]),priority:_0x28f7x13,app:_0xc512[31],appdata:util[_0xc512[21]](_0xc512[32],_0x28f7x11[_0x28f7x12][_0xc512[33]]),UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]});_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[16]]),priority:_0x28f7x13++,app:_0xc512[31],appdata:util[_0xc512[21]](_0xc512[32],_0x28f7x11[_0x28f7x12][_0xc512[33]]),UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]})};if(_0x28f7x11[_0x28f7x12][_0xc512[34]]){_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[20]]),priority:_0x28f7x13,app:_0xc512[35],appdata:_0x28f7x11[_0x28f7x12][_0xc512[13]],UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]});_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[16]]),priority:_0x28f7x13++,app:_0xc512[35],appdata:_0x28f7x11[_0x28f7x12][_0xc512[13]],UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]})};_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[20]]),priority:_0x28f7x13,app:_0xc512[36],appdata:util[_0xc512[21]](_0xc512[37],_0x28f7xe[_0xc512[20]],_0x28f7x11[_0x28f7x12][_0xc512[38]]),UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]});_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[16]]),priority:_0x28f7x13++,app:_0xc512[36],appdata:util[_0xc512[21]](_0xc512[37],_0x28f7xe[_0xc512[16]],_0x28f7x11[_0x28f7x12][_0xc512[38]]),UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]});if(_0x28f7x11[_0x28f7x12][_0xc512[30]]){_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[20]]),priority:_0x28f7x13,app:_0xc512[39],UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]});_0x28f7x10[_0xc512[29]]({context:_0xc512[15],exten:util[_0xc512[21]](_0xc512[25],_0x28f7x11[_0x28f7x12][_0xc512[26]],_0x28f7xe[_0xc512[16]]),priority:_0x28f7x13++,app:_0xc512[39],UserId:_0x28f7xe[_0xc512[23]],ChanSpyId:_0x28f7x11[_0x28f7x12][_0xc512[23]],type:_0xc512[22]})}}})[_0xc512[41]](function(){return _0x28f7x8[_0xc512[44]][_0xc512[43]][_0xc512[42]](_0x28f7x10)[_0xc512[41]](function(){_0x28f7xc()})[_0xc512[40]](function(_0x28f7xf){_0x28f7xc(_0x28f7xf)})})}else {return _0x28f7x8[_0xc512[44]][_0xc512[43]][_0xc512[47]]({where:{UserId:_0x28f7xe[_0xc512[23]],type:_0xc512[22],ChanSpyId:{$ne:null}}})[_0xc512[41]](function(){_0x28f7xc()})[_0xc512[40]](function(_0x28f7xf){_0x28f7xc(_0x28f7xf)})}}else {_0x28f7xc()}},afterDestroy:function(_0x28f7xe,_0x28f7xb){return _0x28f7x8[_0xc512[44]][_0xc512[43]][_0xc512[47]]({where:{UserId:_0x28f7xe[_0xc512[23]],type:_0xc512[22]}})}},instanceMethods:{authenticate:function(_0x28f7x14,_0x28f7x15){if(!_0x28f7x15){return this[_0xc512[13]]=== this[_0xc512[48]](_0x28f7x14)};var _0x28f7x16=this;this[_0xc512[48]](_0x28f7x14,function(_0x28f7xf,_0x28f7x17){if(_0x28f7xf){_0x28f7x15(_0x28f7xf)};if(_0x28f7x16[_0xc512[13]]=== _0x28f7x17){_0x28f7x15(null,true)}else {_0x28f7x15(null,false)}})},makeSalt:function(_0x28f7x18,_0x28f7x15){var _0x28f7x19=16;if( typeof arguments[0]=== _0xc512[49]){_0x28f7x15= arguments[0];_0x28f7x18= _0x28f7x19}else {if( typeof arguments[1]=== _0xc512[49]){_0x28f7x15= arguments[1]}else {throw  new Error(_0xc512[50])}};if(!_0x28f7x18){_0x28f7x18= _0x28f7x19};return crypto[_0xc512[52]](_0x28f7x18,function(_0x28f7xf,_0x28f7x1a){if(_0x28f7xf){_0x28f7x15(_0x28f7xf)};return _0x28f7x15(null,_0x28f7x1a.toString(_0xc512[51]))})},encryptPassword:function(_0x28f7x14,_0x28f7x15){if(!_0x28f7x14||  !this[_0xc512[53]]){return _0x28f7x15?_0x28f7x15(null):null};var _0x28f7x1b=10000;var _0x28f7x1c=64;var _0x28f7x1a= new Buffer(this[_0xc512[53]],_0xc512[51]);if(!_0x28f7x15){return crypto[_0xc512[54]](_0x28f7x14,_0x28f7x1a,_0x28f7x1b,_0x28f7x1c).toString(_0xc512[51])};return crypto[_0xc512[55]](_0x28f7x14,_0x28f7x1a,_0x28f7x1b,_0x28f7x1c,function(_0x28f7xf,_0x28f7x1d){if(_0x28f7xf){_0x28f7x15(_0x28f7xf)};return _0x28f7x15(null,_0x28f7x1d.toString(_0xc512[51]))})},updatePassword:function(_0x28f7xc){if(!this[_0xc512[13]]){return _0x28f7xc(null)};if(!validatePresenceOf(this[_0xc512[13]])&& authTypes[_0xc512[57]](this[_0xc512[56]])===  -1){_0x28f7xc( new Error(_0xc512[58]))};var _0x28f7x16=this;this[_0xc512[59]](function(_0x28f7x1e,_0x28f7x1a){if(_0x28f7x1e){return _0x28f7xc(_0x28f7x1e)};_0x28f7x16[_0xc512[53]]= _0x28f7x1a;_0x28f7x16[_0xc512[48]](_0x28f7x16[_0xc512[13]],function(_0x28f7x1f,_0x28f7x20){if(_0x28f7x1f){_0x28f7xc(_0x28f7x1f)};_0x28f7x16[_0xc512[13]]= _0x28f7x20;_0x28f7xc(null)})})},updateMd5Password:function(){this[_0xc512[60]]= md5(this[_0xc512[20]]+ _0xc512[61]+ this[_0xc512[13]]);return this[_0xc512[60]]}}})}