Built motion from commit (unavailable).|2.5.6
[motion2.git] / server / api / user / user.model.js
index aedd82a..5b77893 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfe54=['_XCALLY_MIXMONITOR_FORMAT=%s','Dial','SIP/%s,,tTxXU(xcally-mixmonitor-context)','SIP/%s,,tTxX','Hangup','priority','defaults','findAll','then','internal','exports','models','define','User','utf8','changed','updateMd5Password','updatePassword','concat','VoiceExtension','bulkCreate','catch','resolve','destroy','encryptPassword','function','Missing\x20Callback','randomBytes','toString','base64','salt','pbkdf2Sync','pbkdf2','sha1','Invalid\x20password','md5secret',':asterisk:','bluebird','crypto','util','md5','./user.attributes','google','length','context','from-sip','system','format','%s%s','push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','auth','password','name','options','join','wav','WAV','gsm','extensionMonitor','includes'];(function(_0x4f15d4,_0x4f75b4){var _0x38e1ce=function(_0x4543a1){while(--_0x4543a1){_0x4f15d4['push'](_0x4f15d4['shift']());}};_0x38e1ce(++_0x4f75b4);}(_0xfe54,0x1b1));var _0x4fe5=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfe54[_0x502c7d];return _0x30b7ed;};'use strict';var BPromise=require(_0x4fe5('0x0'));var crypto=require(_0x4fe5('0x1'));var util=require(_0x4fe5('0x2'));var md5=require(_0x4fe5('0x3'));var _=require('lodash');var attributes=require(_0x4fe5('0x4'));var authTypes=[_0x4fe5('0x5')];var validatePresenceOf=function(_0x28ee21){return _0x28ee21&&_0x28ee21[_0x4fe5('0x6')];};var getChanSpyApplications=function(_0x24dc83,_0x353822,_0x4784ae){var _0x5381e7={'context':_0x24dc83[_0x4fe5('0x7')]||_0x4fe5('0x8'),'type':_0x4fe5('0x9'),'isApp':![],'UserId':_0x24dc83['id']};var _0x596b52=[];for(var _0x524afa=0x0,_0x35e8da=0x1;_0x524afa<_0x4784ae[_0x4fe5('0x6')];_0x524afa++,_0x35e8da=0x1){var _0x4362fd={'exten':util[_0x4fe5('0xa')](_0x4fe5('0xb'),_0x4784ae[_0x524afa]['prefix'],_0x353822),'ChanSpyId':_0x4784ae[_0x524afa]['id']};_0x596b52[_0x4fe5('0xc')](_[_0x4fe5('0xd')]({'app':_0x4fe5('0xe'),'appdata':util['format'](_0x4fe5('0xf'),_0x4fe5('0x10')),'priority':_0x35e8da++},_0x5381e7,_0x4362fd));if(_0x4784ae[_0x524afa][_0x4fe5('0x11')]){_0x596b52['push'](_['merge']({'app':'MixMonitor','appdata':util[_0x4fe5('0xa')](_0x4fe5('0x12'),_0x4784ae[_0x524afa]['recordingFormat']),'priority':_0x35e8da++},_0x5381e7,_0x4362fd));}if(_0x4784ae[_0x524afa][_0x4fe5('0x13')]){_0x596b52[_0x4fe5('0xc')](_[_0x4fe5('0xd')]({'app':'Authenticate','appdata':_0x4784ae[_0x524afa][_0x4fe5('0x14')],'priority':_0x35e8da++},_0x5381e7,_0x4362fd));}_0x596b52['push'](_[_0x4fe5('0xd')]({'app':'ChanSpy','appdata':util['format']('SIP/%s,%s',_0x24dc83[_0x4fe5('0x15')],_0x4784ae[_0x524afa][_0x4fe5('0x16')]?_0x4784ae[_0x524afa][_0x4fe5('0x16')][_0x4fe5('0x17')](''):''),'priority':_0x35e8da++},_0x5381e7,_0x4362fd));if(_0x4784ae[_0x524afa]['record']){_0x596b52[_0x4fe5('0xc')](_[_0x4fe5('0xd')]({'app':'StopMixMonitor','priority':_0x35e8da++},_0x5381e7,_0x4362fd));}}return _0x596b52;};var getUserApplications=function(_0x1f46bd,_0x51bb37){var _0x31ea84=[_0x4fe5('0x18'),_0x4fe5('0x19'),_0x4fe5('0x1a')];var _0x51f2e2={'context':_0x1f46bd[_0x4fe5('0x7')]||_0x4fe5('0x8'),'exten':_0x51bb37,'type':_0x4fe5('0x9'),'isApp':![],'UserId':_0x1f46bd['id']};var _0xfd136b=[{'app':_0x4fe5('0xe'),'appdata':'CDR(type)=internal'}];if(_0x1f46bd[_0x4fe5('0x1b')]&&_[_0x4fe5('0x1c')](_0x31ea84,_0x1f46bd[_0x4fe5('0x1b')])){_0xfd136b[_0x4fe5('0xc')]({'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}'});_0xfd136b[_0x4fe5('0xc')]({'app':_0x4fe5('0xe'),'appdata':util[_0x4fe5('0xa')](_0x4fe5('0x1d'),_0x1f46bd[_0x4fe5('0x1b')])});_0xfd136b[_0x4fe5('0xc')]({'app':_0x4fe5('0x1e'),'appdata':util[_0x4fe5('0xa')](_0x4fe5('0x1f'),_0x1f46bd[_0x4fe5('0x15')])});}else{_0xfd136b['push']({'app':_0x4fe5('0x1e'),'appdata':util[_0x4fe5('0xa')](_0x4fe5('0x20'),_0x1f46bd[_0x4fe5('0x15')])});}_0xfd136b[_0x4fe5('0xc')]({'app':_0x4fe5('0x21')});for(var _0x1ac276=0x0;_0x1ac276<_0xfd136b[_0x4fe5('0x6')];_0x1ac276++){_0xfd136b[_0x1ac276][_0x4fe5('0x22')]=_0x1ac276+0x1;_0xfd136b[_0x1ac276]=_[_0x4fe5('0x23')](_0xfd136b[_0x1ac276],_0x51f2e2);}return _0xfd136b;};var getChanSpyPromise=function(_0x212da1,_0x138be5){return new BPromise(function(_0x15c272,_0x1782bf){return _0x212da1['VoiceChanSpy'][_0x4fe5('0x24')]()[_0x4fe5('0x25')](function(_0x4ce7a4){if(_0x4ce7a4){var _0x368529=getChanSpyApplications(_0x138be5,_0x138be5[_0x4fe5('0x26')],_0x4ce7a4);if(_0x138be5[_0x4fe5('0x26')]!=_0x138be5[_0x4fe5('0x15')]){_0x368529=_0x368529['concat'](getChanSpyApplications(_0x138be5,_0x138be5['name'],_0x4ce7a4));}return _0x15c272(_0x368529);}return _0x15c272([]);})['catch'](function(_0x2f2469){_0x1782bf(_0x2f2469);});});};module[_0x4fe5('0x27')]=function(_0x1ea0e6,_0x1ddeca){var _0x53bd84=_0x1ea0e6[_0x4fe5('0x28')];return _0x1ea0e6[_0x4fe5('0x29')](_0x4fe5('0x2a'),attributes,{'tableName':'users','charset':_0x4fe5('0x2b'),'collate':'utf8_bin','hooks':{'beforeCreate':function(_0x1af4ad,_0x5c3594,_0x3464ca){_0x1af4ad['updateMd5Password']();_0x1af4ad['updatePassword'](_0x3464ca);},'beforeUpdate':function(_0x196754,_0x21663e,_0x47b905){if(_0x196754[_0x4fe5('0x2c')](_0x4fe5('0x14'))){_0x196754[_0x4fe5('0x2d')]();return _0x196754[_0x4fe5('0x2e')](_0x47b905);}_0x47b905();},'afterCreate':function(_0x10d053,_0x37d233,_0x3fbe93){var _0x2fc2ae=getUserApplications(_0x10d053,_0x10d053['internal']);if(_0x10d053[_0x4fe5('0x26')]!=_0x10d053['name']){_0x2fc2ae=_0x2fc2ae[_0x4fe5('0x2f')](getUserApplications(_0x10d053,_0x10d053[_0x4fe5('0x15')]));}return _0x53bd84[_0x4fe5('0x30')][_0x4fe5('0x31')](_0x2fc2ae)['then'](function(){if(_0x10d053['chanspy']){return getChanSpyPromise(_0x53bd84,_0x10d053);}})[_0x4fe5('0x25')](function(_0xfed8be){if(_0xfed8be&&_0xfed8be[_0x4fe5('0x6')]){return _0x53bd84[_0x4fe5('0x30')][_0x4fe5('0x31')](_0xfed8be);}})['then'](function(){_0x3fbe93();})[_0x4fe5('0x32')](function(_0x307562){_0x3fbe93(_0x307562);});},'afterUpdate':function(_0x14e72c,_0x38cd9f,_0x19e192){return BPromise[_0x4fe5('0x33')]()[_0x4fe5('0x25')](function(){if(_0x14e72c[_0x4fe5('0x2c')]('chanspy')||_0x14e72c[_0x4fe5('0x2c')]('context')){return _0x53bd84['VoiceExtension'][_0x4fe5('0x34')]({'where':{'UserId':_0x14e72c['id'],'type':'system','ChanSpyId':{'$ne':null}}})[_0x4fe5('0x25')](function(){if(_0x14e72c['chanspy']){return getChanSpyPromise(_0x53bd84,_0x14e72c)[_0x4fe5('0x25')](function(_0x24dd7c){if(_0x24dd7c&&_0x24dd7c[_0x4fe5('0x6')]){return _0x53bd84['VoiceExtension'][_0x4fe5('0x31')](_0x24dd7c);}});}});}})[_0x4fe5('0x25')](function(){if(_0x14e72c[_0x4fe5('0x2c')](_0x4fe5('0x1b'))||_0x14e72c['changed'](_0x4fe5('0x7'))){return _0x53bd84['VoiceExtension'][_0x4fe5('0x34')]({'where':{'UserId':_0x14e72c['id'],'type':'system','ChanSpyId':null}})[_0x4fe5('0x25')](function(){var _0x1b8462=getUserApplications(_0x14e72c,_0x14e72c[_0x4fe5('0x26')]);if(_0x14e72c[_0x4fe5('0x26')]!=_0x14e72c[_0x4fe5('0x15')]){_0x1b8462=_0x1b8462['concat'](getUserApplications(_0x14e72c,_0x14e72c[_0x4fe5('0x15')]));}return _0x53bd84[_0x4fe5('0x30')]['bulkCreate'](_0x1b8462);});}})[_0x4fe5('0x25')](function(){_0x19e192();})[_0x4fe5('0x32')](function(_0xe650fc){_0x19e192(_0xe650fc);});},'afterDestroy':function(_0x54f89a,_0x4f922f){return _0x53bd84[_0x4fe5('0x30')][_0x4fe5('0x34')]({'where':{'UserId':_0x54f89a['id'],'type':'system'}});}},'instanceMethods':{'authenticate':function(_0x1f1394,_0x4bb8a0){if(!_0x4bb8a0){return this[_0x4fe5('0x14')]===this[_0x4fe5('0x35')](_0x1f1394);}var _0x399b97=this;this[_0x4fe5('0x35')](_0x1f1394,function(_0x1f46c6,_0x183a05){if(_0x1f46c6){_0x4bb8a0(_0x1f46c6);}if(_0x399b97[_0x4fe5('0x14')]===_0x183a05){_0x4bb8a0(null,!![]);}else{_0x4bb8a0(null,![]);}});},'makeSalt':function(_0x5b8829,_0x5b74d1){var _0x654694=0x10;if(typeof arguments[0x0]===_0x4fe5('0x36')){_0x5b74d1=arguments[0x0];_0x5b8829=_0x654694;}else if(typeof arguments[0x1]===_0x4fe5('0x36')){_0x5b74d1=arguments[0x1];}else{throw new Error(_0x4fe5('0x37'));}if(!_0x5b8829){_0x5b8829=_0x654694;}return crypto[_0x4fe5('0x38')](_0x5b8829,function(_0x357549,_0x2a532b){if(_0x357549){_0x5b74d1(_0x357549);}return _0x5b74d1(null,_0x2a532b[_0x4fe5('0x39')](_0x4fe5('0x3a')));});},'encryptPassword':function(_0x1bc599,_0x74f361){if(!_0x1bc599||!this[_0x4fe5('0x3b')]){return _0x74f361?_0x74f361(null):null;}var _0x509684=0x2710;var _0x4822ee=0x40;var _0xf04c85=new Buffer(this[_0x4fe5('0x3b')],_0x4fe5('0x3a'));if(!_0x74f361){return crypto[_0x4fe5('0x3c')](_0x1bc599,_0xf04c85,_0x509684,_0x4822ee,'sha1')[_0x4fe5('0x39')](_0x4fe5('0x3a'));}return crypto[_0x4fe5('0x3d')](_0x1bc599,_0xf04c85,_0x509684,_0x4822ee,_0x4fe5('0x3e'),function(_0x411d71,_0x11c7fb){if(_0x411d71){_0x74f361(_0x411d71);}return _0x74f361(null,_0x11c7fb[_0x4fe5('0x39')](_0x4fe5('0x3a')));});},'updatePassword':function(_0x3cf334){if(!this[_0x4fe5('0x14')]){return _0x3cf334(null);}if(!validatePresenceOf(this['password'])&&authTypes['indexOf'](this['provider'])===-0x1){_0x3cf334(new Error(_0x4fe5('0x3f')));}var _0x23b8de=this;this['makeSalt'](function(_0x37f324,_0x3fb176){if(_0x37f324){return _0x3cf334(_0x37f324);}_0x23b8de['salt']=_0x3fb176;_0x23b8de[_0x4fe5('0x35')](_0x23b8de['password'],function(_0x5cb7d2,_0x30f9db){if(_0x5cb7d2){_0x3cf334(_0x5cb7d2);}_0x23b8de[_0x4fe5('0x14')]=_0x30f9db;_0x3cf334(null);});});},'updateMd5Password':function(){this[_0x4fe5('0x40')]=md5(this[_0x4fe5('0x15')]+_0x4fe5('0x41')+this['password']);return this[_0x4fe5('0x40')];}}});};
\ No newline at end of file
+var _0x1acc=['context','from-sip','system','length','format','%s%s','Set','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','push','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','wav','WAV','gsm','CDR(type)=internal','extensionMonitor','includes','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=%s','SIP/%s,,tTxXU(xcally-mixmonitor-context)','Dial','SIP/%s,,tTxX','Hangup','VoiceChanSpy','findAll','then','internal','concat','catch','models','User','utf8','utf8_bin','updatePassword','updateMd5Password','VoiceExtension','bulkCreate','resolve','changed','destroy','encryptPassword','function','randomBytes','base64','salt','pbkdf2Sync','sha1','toString','pbkdf2','indexOf','provider','Invalid\x20password','md5secret',':asterisk:','bluebird','util','md5','lodash','google'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x1acc,0x14f));var _0xc1ac=function(_0x4cf2b2,_0x41e205){_0x4cf2b2=_0x4cf2b2-0x0;var _0x4778db=_0x1acc[_0x4cf2b2];return _0x4778db;};'use strict';var BPromise=require(_0xc1ac('0x0'));var crypto=require('crypto');var util=require(_0xc1ac('0x1'));var md5=require(_0xc1ac('0x2'));var _=require(_0xc1ac('0x3'));var attributes=require('./user.attributes');var authTypes=[_0xc1ac('0x4')];var validatePresenceOf=function(_0x38aa82){return _0x38aa82&&_0x38aa82['length'];};var getChanSpyApplications=function(_0x5cc516,_0x418d71,_0x41b621){var _0x5e3d46={'context':_0x5cc516[_0xc1ac('0x5')]||_0xc1ac('0x6'),'type':_0xc1ac('0x7'),'isApp':![],'UserId':_0x5cc516['id']};var _0x5d42c0=[];for(var _0x45b43c=0x0,_0xe465c0=0x1;_0x45b43c<_0x41b621[_0xc1ac('0x8')];_0x45b43c++,_0xe465c0=0x1){var _0xc64f15={'exten':util[_0xc1ac('0x9')](_0xc1ac('0xa'),_0x41b621[_0x45b43c]['prefix'],_0x418d71),'ChanSpyId':_0x41b621[_0x45b43c]['id']};_0x5d42c0['push'](_['merge']({'app':_0xc1ac('0xb'),'appdata':util[_0xc1ac('0x9')](_0xc1ac('0xc'),_0xc1ac('0xd')),'priority':_0xe465c0++},_0x5e3d46,_0xc64f15));if(_0x41b621[_0x45b43c][_0xc1ac('0xe')]){_0x5d42c0['push'](_[_0xc1ac('0xf')]({'app':_0xc1ac('0x10'),'appdata':util[_0xc1ac('0x9')](_0xc1ac('0x11'),_0x41b621[_0x45b43c]['recordingFormat']),'priority':_0xe465c0++},_0x5e3d46,_0xc64f15));}if(_0x41b621[_0x45b43c]['auth']){_0x5d42c0[_0xc1ac('0x12')](_[_0xc1ac('0xf')]({'app':_0xc1ac('0x13'),'appdata':_0x41b621[_0x45b43c][_0xc1ac('0x14')],'priority':_0xe465c0++},_0x5e3d46,_0xc64f15));}_0x5d42c0[_0xc1ac('0x12')](_['merge']({'app':_0xc1ac('0x15'),'appdata':util[_0xc1ac('0x9')](_0xc1ac('0x16'),_0x5cc516[_0xc1ac('0x17')],_0x41b621[_0x45b43c]['options']?_0x41b621[_0x45b43c][_0xc1ac('0x18')]['join'](''):''),'priority':_0xe465c0++},_0x5e3d46,_0xc64f15));if(_0x41b621[_0x45b43c][_0xc1ac('0xe')]){_0x5d42c0[_0xc1ac('0x12')](_['merge']({'app':'StopMixMonitor','priority':_0xe465c0++},_0x5e3d46,_0xc64f15));}}return _0x5d42c0;};var getUserApplications=function(_0x26021f,_0x16c996){var _0x2657ab=[_0xc1ac('0x19'),_0xc1ac('0x1a'),_0xc1ac('0x1b')];var _0x42d58b={'context':_0x26021f[_0xc1ac('0x5')]||_0xc1ac('0x6'),'exten':_0x16c996,'type':_0xc1ac('0x7'),'isApp':![],'UserId':_0x26021f['id']};var _0x488e01=[{'app':_0xc1ac('0xb'),'appdata':_0xc1ac('0x1c')}];if(_0x26021f[_0xc1ac('0x1d')]&&_[_0xc1ac('0x1e')](_0x2657ab,_0x26021f[_0xc1ac('0x1d')])){_0x488e01['push']({'app':'Set','appdata':_0xc1ac('0x1f')});_0x488e01['push']({'app':_0xc1ac('0xb'),'appdata':util[_0xc1ac('0x9')](_0xc1ac('0x20'),_0x26021f[_0xc1ac('0x1d')])});_0x488e01['push']({'app':'Dial','appdata':util[_0xc1ac('0x9')](_0xc1ac('0x21'),_0x26021f[_0xc1ac('0x17')])});}else{_0x488e01[_0xc1ac('0x12')]({'app':_0xc1ac('0x22'),'appdata':util[_0xc1ac('0x9')](_0xc1ac('0x23'),_0x26021f[_0xc1ac('0x17')])});}_0x488e01[_0xc1ac('0x12')]({'app':_0xc1ac('0x24')});for(var _0x22d07=0x0;_0x22d07<_0x488e01[_0xc1ac('0x8')];_0x22d07++){_0x488e01[_0x22d07]['priority']=_0x22d07+0x1;_0x488e01[_0x22d07]=_['defaults'](_0x488e01[_0x22d07],_0x42d58b);}return _0x488e01;};var getChanSpyPromise=function(_0x565119,_0x2fd5b4){return new BPromise(function(_0x37738d,_0xaca571){return _0x565119[_0xc1ac('0x25')][_0xc1ac('0x26')]()[_0xc1ac('0x27')](function(_0x48f0a3){if(_0x48f0a3){var _0x53a761=getChanSpyApplications(_0x2fd5b4,_0x2fd5b4[_0xc1ac('0x28')],_0x48f0a3);if(_0x2fd5b4['internal']!=_0x2fd5b4[_0xc1ac('0x17')]){_0x53a761=_0x53a761[_0xc1ac('0x29')](getChanSpyApplications(_0x2fd5b4,_0x2fd5b4[_0xc1ac('0x17')],_0x48f0a3));}return _0x37738d(_0x53a761);}return _0x37738d([]);})[_0xc1ac('0x2a')](function(_0x331fff){_0xaca571(_0x331fff);});});};module['exports']=function(_0x3aeb1e,_0x2868b7){var _0x1bf2a3=_0x3aeb1e[_0xc1ac('0x2b')];return _0x3aeb1e['define'](_0xc1ac('0x2c'),attributes,{'tableName':'users','charset':_0xc1ac('0x2d'),'collate':_0xc1ac('0x2e'),'hooks':{'beforeCreate':function(_0x23307a,_0x4df03b,_0x4f9f27){_0x23307a['updateMd5Password']();_0x23307a[_0xc1ac('0x2f')](_0x4f9f27);},'beforeUpdate':function(_0x19d2f8,_0x24ab94,_0x2123ac){if(_0x19d2f8['changed'](_0xc1ac('0x14'))){_0x19d2f8[_0xc1ac('0x30')]();return _0x19d2f8['updatePassword'](_0x2123ac);}_0x2123ac();},'afterCreate':function(_0xe068a7,_0x1bf362,_0x29e069){var _0x18ecfc=getUserApplications(_0xe068a7,_0xe068a7[_0xc1ac('0x28')]);if(_0xe068a7[_0xc1ac('0x28')]!=_0xe068a7[_0xc1ac('0x17')]){_0x18ecfc=_0x18ecfc[_0xc1ac('0x29')](getUserApplications(_0xe068a7,_0xe068a7[_0xc1ac('0x17')]));}return _0x1bf2a3[_0xc1ac('0x31')]['bulkCreate'](_0x18ecfc)[_0xc1ac('0x27')](function(){if(_0xe068a7['chanspy']){return getChanSpyPromise(_0x1bf2a3,_0xe068a7);}})[_0xc1ac('0x27')](function(_0x1e0d70){if(_0x1e0d70&&_0x1e0d70[_0xc1ac('0x8')]){return _0x1bf2a3['VoiceExtension'][_0xc1ac('0x32')](_0x1e0d70);}})[_0xc1ac('0x27')](function(){_0x29e069();})[_0xc1ac('0x2a')](function(_0x1c9990){_0x29e069(_0x1c9990);});},'afterUpdate':function(_0x363d93,_0xb68987,_0x5a7d9d){return BPromise[_0xc1ac('0x33')]()[_0xc1ac('0x27')](function(){if(_0x363d93[_0xc1ac('0x34')](_0xc1ac('0xd'))||_0x363d93['changed'](_0xc1ac('0x5'))){return _0x1bf2a3[_0xc1ac('0x31')][_0xc1ac('0x35')]({'where':{'UserId':_0x363d93['id'],'type':'system','ChanSpyId':{'$ne':null}}})['then'](function(){if(_0x363d93[_0xc1ac('0xd')]){return getChanSpyPromise(_0x1bf2a3,_0x363d93)[_0xc1ac('0x27')](function(_0x8c16c8){if(_0x8c16c8&&_0x8c16c8[_0xc1ac('0x8')]){return _0x1bf2a3[_0xc1ac('0x31')]['bulkCreate'](_0x8c16c8);}});}});}})[_0xc1ac('0x27')](function(){if(_0x363d93[_0xc1ac('0x34')](_0xc1ac('0x1d'))||_0x363d93['changed'](_0xc1ac('0x5'))){return _0x1bf2a3['VoiceExtension'][_0xc1ac('0x35')]({'where':{'UserId':_0x363d93['id'],'type':_0xc1ac('0x7'),'ChanSpyId':null}})[_0xc1ac('0x27')](function(){var _0x5c8b04=getUserApplications(_0x363d93,_0x363d93[_0xc1ac('0x28')]);if(_0x363d93[_0xc1ac('0x28')]!=_0x363d93['name']){_0x5c8b04=_0x5c8b04[_0xc1ac('0x29')](getUserApplications(_0x363d93,_0x363d93[_0xc1ac('0x17')]));}return _0x1bf2a3[_0xc1ac('0x31')]['bulkCreate'](_0x5c8b04);});}})[_0xc1ac('0x27')](function(){_0x5a7d9d();})[_0xc1ac('0x2a')](function(_0x310936){_0x5a7d9d(_0x310936);});},'afterDestroy':function(_0x24cfce,_0x261874){return _0x1bf2a3[_0xc1ac('0x31')][_0xc1ac('0x35')]({'where':{'UserId':_0x24cfce['id'],'type':'system'}});}},'instanceMethods':{'authenticate':function(_0xa25bf7,_0x224872){if(!_0x224872){return this[_0xc1ac('0x14')]===this[_0xc1ac('0x36')](_0xa25bf7);}var _0x1a6e55=this;this['encryptPassword'](_0xa25bf7,function(_0x24886f,_0x1a11ad){if(_0x24886f){_0x224872(_0x24886f);}if(_0x1a6e55['password']===_0x1a11ad){_0x224872(null,!![]);}else{_0x224872(null,![]);}});},'makeSalt':function(_0x1279e1,_0x55d5ec){var _0x17adda=0x10;if(typeof arguments[0x0]===_0xc1ac('0x37')){_0x55d5ec=arguments[0x0];_0x1279e1=_0x17adda;}else if(typeof arguments[0x1]===_0xc1ac('0x37')){_0x55d5ec=arguments[0x1];}else{throw new Error('Missing\x20Callback');}if(!_0x1279e1){_0x1279e1=_0x17adda;}return crypto[_0xc1ac('0x38')](_0x1279e1,function(_0x3321ca,_0x37fd25){if(_0x3321ca){_0x55d5ec(_0x3321ca);}return _0x55d5ec(null,_0x37fd25['toString'](_0xc1ac('0x39')));});},'encryptPassword':function(_0x42b6db,_0x2c0f6d){if(!_0x42b6db||!this[_0xc1ac('0x3a')]){return _0x2c0f6d?_0x2c0f6d(null):null;}var _0x207f97=0x2710;var _0x1387ae=0x40;var _0xe72bd2=new Buffer(this[_0xc1ac('0x3a')],'base64');if(!_0x2c0f6d){return crypto[_0xc1ac('0x3b')](_0x42b6db,_0xe72bd2,_0x207f97,_0x1387ae,_0xc1ac('0x3c'))[_0xc1ac('0x3d')](_0xc1ac('0x39'));}return crypto[_0xc1ac('0x3e')](_0x42b6db,_0xe72bd2,_0x207f97,_0x1387ae,_0xc1ac('0x3c'),function(_0xd60c83,_0x23295c){if(_0xd60c83){_0x2c0f6d(_0xd60c83);}return _0x2c0f6d(null,_0x23295c[_0xc1ac('0x3d')](_0xc1ac('0x39')));});},'updatePassword':function(_0xa370cf){if(!this[_0xc1ac('0x14')]){return _0xa370cf(null);}if(!validatePresenceOf(this['password'])&&authTypes[_0xc1ac('0x3f')](this[_0xc1ac('0x40')])===-0x1){_0xa370cf(new Error(_0xc1ac('0x41')));}var _0x364dcf=this;this['makeSalt'](function(_0x5de12f,_0x56534f){if(_0x5de12f){return _0xa370cf(_0x5de12f);}_0x364dcf[_0xc1ac('0x3a')]=_0x56534f;_0x364dcf[_0xc1ac('0x36')](_0x364dcf[_0xc1ac('0x14')],function(_0x12e395,_0x42dc25){if(_0x12e395){_0xa370cf(_0x12e395);}_0x364dcf['password']=_0x42dc25;_0xa370cf(null);});});},'updateMd5Password':function(){this[_0xc1ac('0x42')]=md5(this[_0xc1ac('0x17')]+_0xc1ac('0x43')+this['password']);return this[_0xc1ac('0x42')];}}});};
\ No newline at end of file