Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / api / user / user.model.js
index d0cc93f..89224f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x730a=['Hangup','defaults','VoiceChanSpy','findAll','internal','concat','catch','exports','models','define','User','users','utf8','utf8_bin','userProfileId','undefined','resolve','UserProfile','find','then','privacyEnabled','updateMd5Password','updatePassword','changed','password','VoiceExtension','bulkCreate','destroy','encryptPassword','function','Missing\x20Callback','randomBytes','toString','base64','salt','pbkdf2Sync','sha1','pbkdf2','indexOf','Invalid\x20password','makeSalt',':asterisk:','md5secret','bluebird','crypto','md5','lodash','./user.attributes','google','length','context','from-sip','system','format','%s%s','merge','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','name','options','join','StopMixMonitor','gsm','Set','CDR(type)=internal','extensionMonitor','includes','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=%s','Dial','SIP/%s,,tTxXU(xcally-mixmonitor-context)'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0x730a,0x1b1));var _0xa730=function(_0x50c86a,_0x2fec99){_0x50c86a=_0x50c86a-0x0;var _0x53420a=_0x730a[_0x50c86a];return _0x53420a;};'use strict';var BPromise=require(_0xa730('0x0'));var crypto=require(_0xa730('0x1'));var util=require('util');var md5=require(_0xa730('0x2'));var _=require(_0xa730('0x3'));var attributes=require(_0xa730('0x4'));var authTypes=[_0xa730('0x5')];var validatePresenceOf=function(_0x345675){return _0x345675&&_0x345675[_0xa730('0x6')];};var getChanSpyApplications=function(_0xa1aee5,_0x267843,_0x1c4f8d){var _0x4ab476={'context':_0xa1aee5[_0xa730('0x7')]||_0xa730('0x8'),'type':_0xa730('0x9'),'isApp':![],'UserId':_0xa1aee5['id']};var _0x1fed81=[];for(var _0x52cc04=0x0,_0x351847=0x1;_0x52cc04<_0x1c4f8d[_0xa730('0x6')];_0x52cc04++,_0x351847=0x1){var _0x42b26b={'exten':util[_0xa730('0xa')](_0xa730('0xb'),_0x1c4f8d[_0x52cc04]['prefix'],_0x267843),'ChanSpyId':_0x1c4f8d[_0x52cc04]['id']};_0x1fed81['push'](_[_0xa730('0xc')]({'app':'Set','appdata':util['format'](_0xa730('0xd'),_0xa730('0xe')),'priority':_0x351847++},_0x4ab476,_0x42b26b));if(_0x1c4f8d[_0x52cc04][_0xa730('0xf')]){_0x1fed81[_0xa730('0x10')](_[_0xa730('0xc')]({'app':_0xa730('0x11'),'appdata':util[_0xa730('0xa')](_0xa730('0x12'),_0x1c4f8d[_0x52cc04][_0xa730('0x13')]),'priority':_0x351847++},_0x4ab476,_0x42b26b));}if(_0x1c4f8d[_0x52cc04][_0xa730('0x14')]){_0x1fed81['push'](_[_0xa730('0xc')]({'app':_0xa730('0x15'),'appdata':_0x1c4f8d[_0x52cc04]['password'],'priority':_0x351847++},_0x4ab476,_0x42b26b));}_0x1fed81[_0xa730('0x10')](_[_0xa730('0xc')]({'app':'ChanSpy','appdata':util[_0xa730('0xa')]('SIP/%s,%s',_0xa1aee5[_0xa730('0x16')],_0x1c4f8d[_0x52cc04][_0xa730('0x17')]?_0x1c4f8d[_0x52cc04][_0xa730('0x17')][_0xa730('0x18')](''):''),'priority':_0x351847++},_0x4ab476,_0x42b26b));if(_0x1c4f8d[_0x52cc04][_0xa730('0xf')]){_0x1fed81['push'](_[_0xa730('0xc')]({'app':_0xa730('0x19'),'priority':_0x351847++},_0x4ab476,_0x42b26b));}}return _0x1fed81;};var getUserApplications=function(_0x364a8c,_0x421035){var _0x1da08d=['wav','WAV',_0xa730('0x1a')];var _0x299cd0={'context':_0x364a8c[_0xa730('0x7')]||_0xa730('0x8'),'exten':_0x421035,'type':_0xa730('0x9'),'isApp':![],'UserId':_0x364a8c['id']};var _0x2ded2d=[{'app':_0xa730('0x1b'),'appdata':_0xa730('0x1c')}];if(_0x364a8c[_0xa730('0x1d')]&&_[_0xa730('0x1e')](_0x1da08d,_0x364a8c['extensionMonitor'])){_0x2ded2d[_0xa730('0x10')]({'app':_0xa730('0x1b'),'appdata':_0xa730('0x1f')});_0x2ded2d['push']({'app':_0xa730('0x1b'),'appdata':util[_0xa730('0xa')](_0xa730('0x20'),_0x364a8c[_0xa730('0x1d')])});_0x2ded2d[_0xa730('0x10')]({'app':_0xa730('0x21'),'appdata':util[_0xa730('0xa')](_0xa730('0x22'),_0x364a8c[_0xa730('0x16')])});}else{_0x2ded2d[_0xa730('0x10')]({'app':_0xa730('0x21'),'appdata':util[_0xa730('0xa')]('SIP/%s,,tTxX',_0x364a8c[_0xa730('0x16')])});}_0x2ded2d['push']({'app':_0xa730('0x23')});for(var _0x5c464f=0x0;_0x5c464f<_0x2ded2d['length'];_0x5c464f++){_0x2ded2d[_0x5c464f]['priority']=_0x5c464f+0x1;_0x2ded2d[_0x5c464f]=_[_0xa730('0x24')](_0x2ded2d[_0x5c464f],_0x299cd0);}return _0x2ded2d;};var getChanSpyPromise=function(_0x1b4fcc,_0x170783){return new BPromise(function(_0x48115e,_0x482f94){return _0x1b4fcc[_0xa730('0x25')][_0xa730('0x26')]()['then'](function(_0x23feeb){if(_0x23feeb){var _0x5cfc0c=getChanSpyApplications(_0x170783,_0x170783[_0xa730('0x27')],_0x23feeb);if(_0x170783[_0xa730('0x27')]!=_0x170783[_0xa730('0x16')]){_0x5cfc0c=_0x5cfc0c[_0xa730('0x28')](getChanSpyApplications(_0x170783,_0x170783[_0xa730('0x16')],_0x23feeb));}return _0x48115e(_0x5cfc0c);}return _0x48115e([]);})[_0xa730('0x29')](function(_0x4e595d){_0x482f94(_0x4e595d);});});};module[_0xa730('0x2a')]=function(_0x1cbf88,_0x40cc50){var _0x3079e9=_0x1cbf88[_0xa730('0x2b')];return _0x1cbf88[_0xa730('0x2c')](_0xa730('0x2d'),attributes,{'tableName':_0xa730('0x2e'),'charset':_0xa730('0x2f'),'collate':_0xa730('0x30'),'hooks':{'beforeCreate':function(_0x39d9e5,_0x437d76,_0x4bd39c){var _0x2d01a6=typeof _0x39d9e5[_0xa730('0x31')]===_0xa730('0x32')?BPromise[_0xa730('0x33')](null):_0x3079e9[_0xa730('0x34')][_0xa730('0x35')]({'where':{'id':_0x39d9e5[_0xa730('0x31')]}});_0x2d01a6[_0xa730('0x36')](function(_0x2842ce){if(_0x2842ce){_0x39d9e5[_0xa730('0x37')]=_0x2842ce['privacyEnabled'];}})[_0xa730('0x36')](function(){_0x39d9e5[_0xa730('0x38')]();_0x39d9e5[_0xa730('0x39')](_0x4bd39c);})[_0xa730('0x29')](function(_0xd4fa30){_0x4bd39c(_0xd4fa30);});},'beforeUpdate':function(_0x28c971,_0x25e176,_0x183259){Promise[_0xa730('0x33')]()[_0xa730('0x36')](function(){if(_0x28c971[_0xa730('0x3a')](_0xa730('0x31'))===![])return;return _0x3079e9[_0xa730('0x34')][_0xa730('0x35')]({'where':{'id':_0x28c971['userProfileId']}})[_0xa730('0x36')](function(_0x3a7212){if(_0x3a7212)_0x28c971[_0xa730('0x37')]=_0x3a7212['privacyEnabled'];return;});})['then'](function(){if(_0x28c971[_0xa730('0x3a')](_0xa730('0x3b'))){_0x28c971['updateMd5Password']();return _0x28c971['updatePassword'](_0x183259);}_0x183259();})[_0xa730('0x29')](function(_0x4edbc5){_0x183259(_0x4edbc5);});},'afterCreate':function(_0x4bc1c1,_0x33ba2b,_0xe0c056){var _0x35f89d=getUserApplications(_0x4bc1c1,_0x4bc1c1['internal']);if(_0x4bc1c1[_0xa730('0x27')]!=_0x4bc1c1[_0xa730('0x16')]){_0x35f89d=_0x35f89d[_0xa730('0x28')](getUserApplications(_0x4bc1c1,_0x4bc1c1['name']));}return _0x3079e9[_0xa730('0x3c')][_0xa730('0x3d')](_0x35f89d)[_0xa730('0x36')](function(){if(_0x4bc1c1['chanspy']){return getChanSpyPromise(_0x3079e9,_0x4bc1c1);}})[_0xa730('0x36')](function(_0x5d7b00){if(_0x5d7b00&&_0x5d7b00[_0xa730('0x6')]){return _0x3079e9[_0xa730('0x3c')][_0xa730('0x3d')](_0x5d7b00);}})[_0xa730('0x36')](function(){_0xe0c056();})['catch'](function(_0x162c0e){_0xe0c056(_0x162c0e);});},'afterUpdate':function(_0x22ec70,_0x20c1bb,_0x3200da){return BPromise['resolve']()['then'](function(){if(_0x22ec70[_0xa730('0x3a')](_0xa730('0xe'))||_0x22ec70[_0xa730('0x3a')]('context')){return _0x3079e9[_0xa730('0x3c')]['destroy']({'where':{'UserId':_0x22ec70['id'],'type':_0xa730('0x9'),'ChanSpyId':{'$ne':null}}})[_0xa730('0x36')](function(){if(_0x22ec70['chanspy']){return getChanSpyPromise(_0x3079e9,_0x22ec70)[_0xa730('0x36')](function(_0x334b1e){if(_0x334b1e&&_0x334b1e[_0xa730('0x6')]){return _0x3079e9[_0xa730('0x3c')][_0xa730('0x3d')](_0x334b1e);}});}});}})[_0xa730('0x36')](function(){if(_0x22ec70['changed'](_0xa730('0x1d'))||_0x22ec70[_0xa730('0x3a')](_0xa730('0x7'))){return _0x3079e9[_0xa730('0x3c')][_0xa730('0x3e')]({'where':{'UserId':_0x22ec70['id'],'type':_0xa730('0x9'),'ChanSpyId':null}})['then'](function(){var _0x2f9378=getUserApplications(_0x22ec70,_0x22ec70[_0xa730('0x27')]);if(_0x22ec70[_0xa730('0x27')]!=_0x22ec70['name']){_0x2f9378=_0x2f9378['concat'](getUserApplications(_0x22ec70,_0x22ec70[_0xa730('0x16')]));}return _0x3079e9[_0xa730('0x3c')][_0xa730('0x3d')](_0x2f9378);});}})[_0xa730('0x36')](function(){_0x3200da();})[_0xa730('0x29')](function(_0x4e1eca){_0x3200da(_0x4e1eca);});},'afterDestroy':function(_0x131595,_0x56b208){return _0x3079e9[_0xa730('0x3c')][_0xa730('0x3e')]({'where':{'UserId':_0x131595['id'],'type':_0xa730('0x9')}});}},'instanceMethods':{'authenticate':function(_0x26b807,_0x4cefc5){if(!_0x4cefc5){return this[_0xa730('0x3b')]===this[_0xa730('0x3f')](_0x26b807);}var _0x5618f9=this;this[_0xa730('0x3f')](_0x26b807,function(_0x58a098,_0x41ae57){if(_0x58a098){_0x4cefc5(_0x58a098);}if(_0x5618f9[_0xa730('0x3b')]===_0x41ae57){_0x4cefc5(null,!![]);}else{_0x4cefc5(null,![]);}});},'makeSalt':function(_0x330c19,_0x5d1de4){var _0x5c3339=0x10;if(typeof arguments[0x0]===_0xa730('0x40')){_0x5d1de4=arguments[0x0];_0x330c19=_0x5c3339;}else if(typeof arguments[0x1]===_0xa730('0x40')){_0x5d1de4=arguments[0x1];}else{throw new Error(_0xa730('0x41'));}if(!_0x330c19){_0x330c19=_0x5c3339;}return crypto[_0xa730('0x42')](_0x330c19,function(_0x5aece0,_0x6d5352){if(_0x5aece0){_0x5d1de4(_0x5aece0);}return _0x5d1de4(null,_0x6d5352[_0xa730('0x43')](_0xa730('0x44')));});},'encryptPassword':function(_0xcc2607,_0x285865){if(!_0xcc2607||!this[_0xa730('0x45')]){return _0x285865?_0x285865(null):null;}var _0x46700b=0x2710;var _0x23f28c=0x40;var _0x37289a=new Buffer(this[_0xa730('0x45')],'base64');if(!_0x285865){return crypto[_0xa730('0x46')](_0xcc2607,_0x37289a,_0x46700b,_0x23f28c,_0xa730('0x47'))['toString']('base64');}return crypto[_0xa730('0x48')](_0xcc2607,_0x37289a,_0x46700b,_0x23f28c,_0xa730('0x47'),function(_0xc734c2,_0x55ad5d){if(_0xc734c2){_0x285865(_0xc734c2);}return _0x285865(null,_0x55ad5d[_0xa730('0x43')]('base64'));});},'updatePassword':function(_0x1b11c5){if(!this[_0xa730('0x3b')]){return _0x1b11c5(null);}if(!validatePresenceOf(this[_0xa730('0x3b')])&&authTypes[_0xa730('0x49')](this['provider'])===-0x1){_0x1b11c5(new Error(_0xa730('0x4a')));}var _0x519d3b=this;this[_0xa730('0x4b')](function(_0x6a611,_0xd7ac3f){if(_0x6a611){return _0x1b11c5(_0x6a611);}_0x519d3b['salt']=_0xd7ac3f;_0x519d3b[_0xa730('0x3f')](_0x519d3b[_0xa730('0x3b')],function(_0x4fe452,_0x2757fb){if(_0x4fe452){_0x1b11c5(_0x4fe452);}_0x519d3b['password']=_0x2757fb;_0x1b11c5(null);});});},'updateMd5Password':function(){this['md5secret']=md5(this[_0xa730('0x16')]+_0xa730('0x4c')+this['password']);return this[_0xa730('0x4d')];}}});};
\ No newline at end of file
+var _0x74ce=['prefix','push','merge','Set','CDR(type)=%s','chanspy','record','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','WAV','system','extensionMonitor','includes','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=%s','Dial','SIP/%s,,tTxXU(xcally-mixmonitor-context)','SIP/%s,,tTxX','Hangup','priority','defaults','VoiceChanSpy','findAll','then','concat','exports','models','define','User','users','utf8','userProfileId','undefined','UserProfile','find','privacyEnabled','updatePassword','resolve','changed','updateMd5Password','catch','internal','bulkCreate','VoiceExtension','destroy','encryptPassword','function','Missing\x20Callback','randomBytes','salt','sha1','toString','pbkdf2','indexOf','provider','Invalid\x20password','makeSalt','md5secret',':asterisk:','bluebird','crypto','util','lodash','google','context','from-sip','length','format','%s%s'];(function(_0x3c44e1,_0x47eb6d){var _0x129511=function(_0x16df03){while(--_0x16df03){_0x3c44e1['push'](_0x3c44e1['shift']());}};_0x129511(++_0x47eb6d);}(_0x74ce,0x8e));var _0xe74c=function(_0x17dd07,_0x192189){_0x17dd07=_0x17dd07-0x0;var _0x2cebb1=_0x74ce[_0x17dd07];return _0x2cebb1;};'use strict';var BPromise=require(_0xe74c('0x0'));var crypto=require(_0xe74c('0x1'));var util=require(_0xe74c('0x2'));var md5=require('md5');var _=require(_0xe74c('0x3'));var attributes=require('./user.attributes');var authTypes=[_0xe74c('0x4')];var validatePresenceOf=function(_0x2bd6aa){return _0x2bd6aa&&_0x2bd6aa['length'];};var getChanSpyApplications=function(_0x2b13e5,_0x459968,_0x3be1f8){var _0x5a19f8={'context':_0x2b13e5[_0xe74c('0x5')]||_0xe74c('0x6'),'type':'system','isApp':![],'UserId':_0x2b13e5['id']};var _0x1992a0=[];for(var _0x38271a=0x0,_0x297595=0x1;_0x38271a<_0x3be1f8[_0xe74c('0x7')];_0x38271a++,_0x297595=0x1){var _0x4277ec={'exten':util[_0xe74c('0x8')](_0xe74c('0x9'),_0x3be1f8[_0x38271a][_0xe74c('0xa')],_0x459968),'ChanSpyId':_0x3be1f8[_0x38271a]['id']};_0x1992a0[_0xe74c('0xb')](_[_0xe74c('0xc')]({'app':_0xe74c('0xd'),'appdata':util[_0xe74c('0x8')](_0xe74c('0xe'),_0xe74c('0xf')),'priority':_0x297595++},_0x5a19f8,_0x4277ec));if(_0x3be1f8[_0x38271a][_0xe74c('0x10')]){_0x1992a0[_0xe74c('0xb')](_[_0xe74c('0xc')]({'app':'MixMonitor','appdata':util[_0xe74c('0x8')]('${UNIQUEID}.%s,a',_0x3be1f8[_0x38271a][_0xe74c('0x11')]),'priority':_0x297595++},_0x5a19f8,_0x4277ec));}if(_0x3be1f8[_0x38271a]['auth']){_0x1992a0[_0xe74c('0xb')](_[_0xe74c('0xc')]({'app':_0xe74c('0x12'),'appdata':_0x3be1f8[_0x38271a][_0xe74c('0x13')],'priority':_0x297595++},_0x5a19f8,_0x4277ec));}_0x1992a0['push'](_['merge']({'app':_0xe74c('0x14'),'appdata':util['format'](_0xe74c('0x15'),_0x2b13e5[_0xe74c('0x16')],_0x3be1f8[_0x38271a][_0xe74c('0x17')]?_0x3be1f8[_0x38271a][_0xe74c('0x17')][_0xe74c('0x18')](''):''),'priority':_0x297595++},_0x5a19f8,_0x4277ec));if(_0x3be1f8[_0x38271a][_0xe74c('0x10')]){_0x1992a0['push'](_[_0xe74c('0xc')]({'app':_0xe74c('0x19'),'priority':_0x297595++},_0x5a19f8,_0x4277ec));}}return _0x1992a0;};var getUserApplications=function(_0xf21163,_0x49538e){var _0x2d5794=['wav',_0xe74c('0x1a'),'gsm'];var _0x446839={'context':_0xf21163[_0xe74c('0x5')]||'from-sip','exten':_0x49538e,'type':_0xe74c('0x1b'),'isApp':![],'UserId':_0xf21163['id']};var _0x78a854=[{'app':_0xe74c('0xd'),'appdata':'CDR(type)=internal'}];if(_0xf21163[_0xe74c('0x1c')]&&_[_0xe74c('0x1d')](_0x2d5794,_0xf21163[_0xe74c('0x1c')])){_0x78a854[_0xe74c('0xb')]({'app':_0xe74c('0xd'),'appdata':_0xe74c('0x1e')});_0x78a854[_0xe74c('0xb')]({'app':'Set','appdata':util[_0xe74c('0x8')](_0xe74c('0x1f'),_0xf21163['extensionMonitor'])});_0x78a854[_0xe74c('0xb')]({'app':_0xe74c('0x20'),'appdata':util[_0xe74c('0x8')](_0xe74c('0x21'),_0xf21163[_0xe74c('0x16')])});}else{_0x78a854['push']({'app':'Dial','appdata':util[_0xe74c('0x8')](_0xe74c('0x22'),_0xf21163[_0xe74c('0x16')])});}_0x78a854['push']({'app':_0xe74c('0x23')});for(var _0x15e4f7=0x0;_0x15e4f7<_0x78a854[_0xe74c('0x7')];_0x15e4f7++){_0x78a854[_0x15e4f7][_0xe74c('0x24')]=_0x15e4f7+0x1;_0x78a854[_0x15e4f7]=_[_0xe74c('0x25')](_0x78a854[_0x15e4f7],_0x446839);}return _0x78a854;};var getChanSpyPromise=function(_0x4e7378,_0x580206){return new BPromise(function(_0x129689,_0x24169e){return _0x4e7378[_0xe74c('0x26')][_0xe74c('0x27')]()[_0xe74c('0x28')](function(_0x7a3d5c){if(_0x7a3d5c){var _0x56fe70=getChanSpyApplications(_0x580206,_0x580206['internal'],_0x7a3d5c);if(_0x580206['internal']!=_0x580206[_0xe74c('0x16')]){_0x56fe70=_0x56fe70[_0xe74c('0x29')](getChanSpyApplications(_0x580206,_0x580206[_0xe74c('0x16')],_0x7a3d5c));}return _0x129689(_0x56fe70);}return _0x129689([]);})['catch'](function(_0x38d471){_0x24169e(_0x38d471);});});};module[_0xe74c('0x2a')]=function(_0x56444b,_0x4974a0){var _0x106e55=_0x56444b[_0xe74c('0x2b')];return _0x56444b[_0xe74c('0x2c')](_0xe74c('0x2d'),attributes,{'tableName':_0xe74c('0x2e'),'charset':_0xe74c('0x2f'),'collate':'utf8_bin','hooks':{'beforeCreate':function(_0x3f6a11,_0x57c7ce,_0xf5b848){var _0x320392=typeof _0x3f6a11[_0xe74c('0x30')]===_0xe74c('0x31')?BPromise['resolve'](null):_0x106e55[_0xe74c('0x32')][_0xe74c('0x33')]({'where':{'id':_0x3f6a11['userProfileId']}});_0x320392['then'](function(_0x39105e){if(_0x39105e){_0x3f6a11[_0xe74c('0x34')]=_0x39105e[_0xe74c('0x34')];}})['then'](function(){_0x3f6a11['updateMd5Password']();_0x3f6a11[_0xe74c('0x35')](_0xf5b848);})['catch'](function(_0x142df2){_0xf5b848(_0x142df2);});},'beforeUpdate':function(_0x12e488,_0x3dc592,_0x53a5af){Promise[_0xe74c('0x36')]()[_0xe74c('0x28')](function(){if(_0x12e488['changed'](_0xe74c('0x30'))===![])return;return _0x106e55[_0xe74c('0x32')][_0xe74c('0x33')]({'where':{'id':_0x12e488['userProfileId']}})[_0xe74c('0x28')](function(_0x586414){if(_0x586414)_0x12e488[_0xe74c('0x34')]=_0x586414[_0xe74c('0x34')];return;});})[_0xe74c('0x28')](function(){if(_0x12e488[_0xe74c('0x37')](_0xe74c('0x13'))){_0x12e488[_0xe74c('0x38')]();return _0x12e488['updatePassword'](_0x53a5af);}_0x53a5af();})[_0xe74c('0x39')](function(_0x81045f){_0x53a5af(_0x81045f);});},'afterCreate':function(_0x3b7aff,_0x4f71ef,_0x1f464c){var _0x1ad9cd=getUserApplications(_0x3b7aff,_0x3b7aff[_0xe74c('0x3a')]);if(_0x3b7aff[_0xe74c('0x3a')]!=_0x3b7aff[_0xe74c('0x16')]){_0x1ad9cd=_0x1ad9cd[_0xe74c('0x29')](getUserApplications(_0x3b7aff,_0x3b7aff[_0xe74c('0x16')]));}return _0x106e55['VoiceExtension'][_0xe74c('0x3b')](_0x1ad9cd)[_0xe74c('0x28')](function(){if(_0x3b7aff[_0xe74c('0xf')]){return getChanSpyPromise(_0x106e55,_0x3b7aff);}})[_0xe74c('0x28')](function(_0x3a91f6){if(_0x3a91f6&&_0x3a91f6['length']){return _0x106e55['VoiceExtension']['bulkCreate'](_0x3a91f6);}})['then'](function(){_0x1f464c();})['catch'](function(_0x7868f6){_0x1f464c(_0x7868f6);});},'afterUpdate':function(_0xfbc1f1,_0x411581,_0x58361c){return BPromise['resolve']()[_0xe74c('0x28')](function(){if(_0xfbc1f1[_0xe74c('0x37')](_0xe74c('0xf'))||_0xfbc1f1[_0xe74c('0x37')](_0xe74c('0x5'))){return _0x106e55[_0xe74c('0x3c')][_0xe74c('0x3d')]({'where':{'UserId':_0xfbc1f1['id'],'type':_0xe74c('0x1b'),'ChanSpyId':{'$ne':null}}})['then'](function(){if(_0xfbc1f1[_0xe74c('0xf')]){return getChanSpyPromise(_0x106e55,_0xfbc1f1)[_0xe74c('0x28')](function(_0x2ed05a){if(_0x2ed05a&&_0x2ed05a[_0xe74c('0x7')]){return _0x106e55[_0xe74c('0x3c')]['bulkCreate'](_0x2ed05a);}});}});}})[_0xe74c('0x28')](function(){if(_0xfbc1f1['changed']('extensionMonitor')||_0xfbc1f1[_0xe74c('0x37')](_0xe74c('0x5'))){return _0x106e55[_0xe74c('0x3c')][_0xe74c('0x3d')]({'where':{'UserId':_0xfbc1f1['id'],'type':_0xe74c('0x1b'),'ChanSpyId':null}})['then'](function(){var _0x5898f8=getUserApplications(_0xfbc1f1,_0xfbc1f1[_0xe74c('0x3a')]);if(_0xfbc1f1[_0xe74c('0x3a')]!=_0xfbc1f1[_0xe74c('0x16')]){_0x5898f8=_0x5898f8[_0xe74c('0x29')](getUserApplications(_0xfbc1f1,_0xfbc1f1[_0xe74c('0x16')]));}return _0x106e55['VoiceExtension']['bulkCreate'](_0x5898f8);});}})['then'](function(){_0x58361c();})[_0xe74c('0x39')](function(_0x376046){_0x58361c(_0x376046);});},'afterDestroy':function(_0xb7634a,_0x3c0553){return _0x106e55[_0xe74c('0x3c')]['destroy']({'where':{'UserId':_0xb7634a['id'],'type':_0xe74c('0x1b')}});}},'instanceMethods':{'authenticate':function(_0x229ab5,_0x454608){if(!_0x454608){return this['password']===this[_0xe74c('0x3e')](_0x229ab5);}var _0x21e33f=this;this[_0xe74c('0x3e')](_0x229ab5,function(_0x199ef6,_0x247ef9){if(_0x199ef6){_0x454608(_0x199ef6);}if(_0x21e33f[_0xe74c('0x13')]===_0x247ef9){_0x454608(null,!![]);}else{_0x454608(null,![]);}});},'makeSalt':function(_0x47918c,_0x5122fb){var _0x64a5fd=0x10;if(typeof arguments[0x0]===_0xe74c('0x3f')){_0x5122fb=arguments[0x0];_0x47918c=_0x64a5fd;}else if(typeof arguments[0x1]===_0xe74c('0x3f')){_0x5122fb=arguments[0x1];}else{throw new Error(_0xe74c('0x40'));}if(!_0x47918c){_0x47918c=_0x64a5fd;}return crypto[_0xe74c('0x41')](_0x47918c,function(_0x26ebfd,_0x190264){if(_0x26ebfd){_0x5122fb(_0x26ebfd);}return _0x5122fb(null,_0x190264['toString']('base64'));});},'encryptPassword':function(_0x45a831,_0x451224){if(!_0x45a831||!this[_0xe74c('0x42')]){return _0x451224?_0x451224(null):null;}var _0x57f5cd=0x2710;var _0x369e12=0x40;var _0x4418ca=new Buffer(this['salt'],'base64');if(!_0x451224){return crypto['pbkdf2Sync'](_0x45a831,_0x4418ca,_0x57f5cd,_0x369e12,_0xe74c('0x43'))[_0xe74c('0x44')]('base64');}return crypto[_0xe74c('0x45')](_0x45a831,_0x4418ca,_0x57f5cd,_0x369e12,'sha1',function(_0x34a74d,_0x2d1db0){if(_0x34a74d){_0x451224(_0x34a74d);}return _0x451224(null,_0x2d1db0[_0xe74c('0x44')]('base64'));});},'updatePassword':function(_0x2aec5e){if(!this[_0xe74c('0x13')]){return _0x2aec5e(null);}if(!validatePresenceOf(this[_0xe74c('0x13')])&&authTypes[_0xe74c('0x46')](this[_0xe74c('0x47')])===-0x1){_0x2aec5e(new Error(_0xe74c('0x48')));}var _0x523706=this;this[_0xe74c('0x49')](function(_0x407ad2,_0x1a0612){if(_0x407ad2){return _0x2aec5e(_0x407ad2);}_0x523706[_0xe74c('0x42')]=_0x1a0612;_0x523706['encryptPassword'](_0x523706[_0xe74c('0x13')],function(_0x299994,_0x48e892){if(_0x299994){_0x2aec5e(_0x299994);}_0x523706[_0xe74c('0x13')]=_0x48e892;_0x2aec5e(null);});});},'updateMd5Password':function(){this[_0xe74c('0x4a')]=md5(this['name']+_0xe74c('0x4b')+this[_0xe74c('0x13')]);return this['md5secret'];}}});};
\ No newline at end of file