Built motion from commit (unavailable).|2.5.30
[motion2.git] / server / api / user / user.model.js
index 134a25a..d0cc93f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1d99=['models','define','User','users','utf8','utf8_bin','updateMd5Password','updatePassword','bulkCreate','VoiceExtension','changed','context','destroy','encryptPassword','function','randomBytes','base64','salt','pbkdf2Sync','sha1','pbkdf2','toString','indexOf','provider','Invalid\x20password','md5secret',':asterisk:','bluebird','crypto','md5','length','from-sip','system','%s%s','prefix','push','merge','Set','chanspy','MixMonitor','format','auth','password','ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','wav','extensionMonitor','includes','_XCALLY_MIXMONITOR_FORMAT=%s','Dial','SIP/%s,,tTxXU(xcally-mixmonitor-context)','SIP/%s,,tTxX','Hangup','priority','defaults','VoiceChanSpy','findAll','then','internal','concat','catch','exports'];(function(_0x20f30d,_0x9b2da){var _0x5a0881=function(_0x3d4cc4){while(--_0x3d4cc4){_0x20f30d['push'](_0x20f30d['shift']());}};_0x5a0881(++_0x9b2da);}(_0x1d99,0x1f0));var _0x91d9=function(_0x3fe72a,_0x340960){_0x3fe72a=_0x3fe72a-0x0;var _0x51b62a=_0x1d99[_0x3fe72a];return _0x51b62a;};'use strict';var BPromise=require(_0x91d9('0x0'));var crypto=require(_0x91d9('0x1'));var util=require('util');var md5=require(_0x91d9('0x2'));var _=require('lodash');var attributes=require('./user.attributes');var authTypes=['google'];var validatePresenceOf=function(_0x2c656b){return _0x2c656b&&_0x2c656b[_0x91d9('0x3')];};var getChanSpyApplications=function(_0x44843d,_0x47a5a5,_0x1bce4d){var _0x45492d={'context':_0x44843d['context']||_0x91d9('0x4'),'type':_0x91d9('0x5'),'isApp':![],'UserId':_0x44843d['id']};var _0x5381b3=[];for(var _0x3c5edf=0x0,_0x570406=0x1;_0x3c5edf<_0x1bce4d[_0x91d9('0x3')];_0x3c5edf++,_0x570406=0x1){var _0x11bbe7={'exten':util['format'](_0x91d9('0x6'),_0x1bce4d[_0x3c5edf][_0x91d9('0x7')],_0x47a5a5),'ChanSpyId':_0x1bce4d[_0x3c5edf]['id']};_0x5381b3[_0x91d9('0x8')](_[_0x91d9('0x9')]({'app':_0x91d9('0xa'),'appdata':util['format']('CDR(type)=%s',_0x91d9('0xb')),'priority':_0x570406++},_0x45492d,_0x11bbe7));if(_0x1bce4d[_0x3c5edf]['record']){_0x5381b3[_0x91d9('0x8')](_['merge']({'app':_0x91d9('0xc'),'appdata':util[_0x91d9('0xd')]('${UNIQUEID}.%s,a',_0x1bce4d[_0x3c5edf]['recordingFormat']),'priority':_0x570406++},_0x45492d,_0x11bbe7));}if(_0x1bce4d[_0x3c5edf][_0x91d9('0xe')]){_0x5381b3[_0x91d9('0x8')](_[_0x91d9('0x9')]({'app':'Authenticate','appdata':_0x1bce4d[_0x3c5edf][_0x91d9('0xf')],'priority':_0x570406++},_0x45492d,_0x11bbe7));}_0x5381b3['push'](_[_0x91d9('0x9')]({'app':_0x91d9('0x10'),'appdata':util['format'](_0x91d9('0x11'),_0x44843d[_0x91d9('0x12')],_0x1bce4d[_0x3c5edf]['options']?_0x1bce4d[_0x3c5edf][_0x91d9('0x13')][_0x91d9('0x14')](''):''),'priority':_0x570406++},_0x45492d,_0x11bbe7));if(_0x1bce4d[_0x3c5edf][_0x91d9('0x15')]){_0x5381b3[_0x91d9('0x8')](_[_0x91d9('0x9')]({'app':_0x91d9('0x16'),'priority':_0x570406++},_0x45492d,_0x11bbe7));}}return _0x5381b3;};var getUserApplications=function(_0x2989f9,_0x4ead03){var _0x2056ab=[_0x91d9('0x17'),'WAV','gsm'];var _0x47927c={'context':_0x2989f9['context']||_0x91d9('0x4'),'exten':_0x4ead03,'type':_0x91d9('0x5'),'isApp':![],'UserId':_0x2989f9['id']};var _0x28bb25=[{'app':'Set','appdata':'CDR(type)=internal'}];if(_0x2989f9[_0x91d9('0x18')]&&_[_0x91d9('0x19')](_0x2056ab,_0x2989f9[_0x91d9('0x18')])){_0x28bb25[_0x91d9('0x8')]({'app':_0x91d9('0xa'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}'});_0x28bb25['push']({'app':'Set','appdata':util['format'](_0x91d9('0x1a'),_0x2989f9[_0x91d9('0x18')])});_0x28bb25[_0x91d9('0x8')]({'app':_0x91d9('0x1b'),'appdata':util[_0x91d9('0xd')](_0x91d9('0x1c'),_0x2989f9[_0x91d9('0x12')])});}else{_0x28bb25['push']({'app':_0x91d9('0x1b'),'appdata':util[_0x91d9('0xd')](_0x91d9('0x1d'),_0x2989f9[_0x91d9('0x12')])});}_0x28bb25['push']({'app':_0x91d9('0x1e')});for(var _0x35eda3=0x0;_0x35eda3<_0x28bb25['length'];_0x35eda3++){_0x28bb25[_0x35eda3][_0x91d9('0x1f')]=_0x35eda3+0x1;_0x28bb25[_0x35eda3]=_[_0x91d9('0x20')](_0x28bb25[_0x35eda3],_0x47927c);}return _0x28bb25;};var getChanSpyPromise=function(_0x1767ae,_0x456d55){return new BPromise(function(_0x3774d5,_0x490d5d){return _0x1767ae[_0x91d9('0x21')][_0x91d9('0x22')]()[_0x91d9('0x23')](function(_0x46a219){if(_0x46a219){var _0x21e9d9=getChanSpyApplications(_0x456d55,_0x456d55[_0x91d9('0x24')],_0x46a219);if(_0x456d55[_0x91d9('0x24')]!=_0x456d55[_0x91d9('0x12')]){_0x21e9d9=_0x21e9d9[_0x91d9('0x25')](getChanSpyApplications(_0x456d55,_0x456d55['name'],_0x46a219));}return _0x3774d5(_0x21e9d9);}return _0x3774d5([]);})[_0x91d9('0x26')](function(_0x331d6a){_0x490d5d(_0x331d6a);});});};module[_0x91d9('0x27')]=function(_0x1cd808,_0x202711){var _0x114049=_0x1cd808[_0x91d9('0x28')];return _0x1cd808[_0x91d9('0x29')](_0x91d9('0x2a'),attributes,{'tableName':_0x91d9('0x2b'),'charset':_0x91d9('0x2c'),'collate':_0x91d9('0x2d'),'hooks':{'beforeCreate':function(_0x168cba,_0x8f402e,_0xa31ce9){_0x168cba[_0x91d9('0x2e')]();_0x168cba[_0x91d9('0x2f')](_0xa31ce9);},'beforeUpdate':function(_0xe7b346,_0x5ca974,_0x55f801){if(_0xe7b346['changed'](_0x91d9('0xf'))){_0xe7b346[_0x91d9('0x2e')]();return _0xe7b346[_0x91d9('0x2f')](_0x55f801);}_0x55f801();},'afterCreate':function(_0x497d67,_0x40662f,_0x48cd6e){var _0x156742=getUserApplications(_0x497d67,_0x497d67[_0x91d9('0x24')]);if(_0x497d67[_0x91d9('0x24')]!=_0x497d67[_0x91d9('0x12')]){_0x156742=_0x156742[_0x91d9('0x25')](getUserApplications(_0x497d67,_0x497d67[_0x91d9('0x12')]));}return _0x114049['VoiceExtension'][_0x91d9('0x30')](_0x156742)['then'](function(){if(_0x497d67['chanspy']){return getChanSpyPromise(_0x114049,_0x497d67);}})[_0x91d9('0x23')](function(_0x7313b){if(_0x7313b&&_0x7313b[_0x91d9('0x3')]){return _0x114049[_0x91d9('0x31')][_0x91d9('0x30')](_0x7313b);}})['then'](function(){_0x48cd6e();})[_0x91d9('0x26')](function(_0x2ce32e){_0x48cd6e(_0x2ce32e);});},'afterUpdate':function(_0x553352,_0x58b311,_0x4d588c){return BPromise['resolve']()[_0x91d9('0x23')](function(){if(_0x553352[_0x91d9('0x32')](_0x91d9('0xb'))||_0x553352[_0x91d9('0x32')]('context')){return _0x114049[_0x91d9('0x31')]['destroy']({'where':{'UserId':_0x553352['id'],'type':_0x91d9('0x5'),'ChanSpyId':{'$ne':null}}})[_0x91d9('0x23')](function(){if(_0x553352[_0x91d9('0xb')]){return getChanSpyPromise(_0x114049,_0x553352)[_0x91d9('0x23')](function(_0xce93a0){if(_0xce93a0&&_0xce93a0[_0x91d9('0x3')]){return _0x114049['VoiceExtension'][_0x91d9('0x30')](_0xce93a0);}});}});}})[_0x91d9('0x23')](function(){if(_0x553352['changed'](_0x91d9('0x18'))||_0x553352['changed'](_0x91d9('0x33'))){return _0x114049[_0x91d9('0x31')][_0x91d9('0x34')]({'where':{'UserId':_0x553352['id'],'type':_0x91d9('0x5'),'ChanSpyId':null}})[_0x91d9('0x23')](function(){var _0x40a0fc=getUserApplications(_0x553352,_0x553352[_0x91d9('0x24')]);if(_0x553352[_0x91d9('0x24')]!=_0x553352['name']){_0x40a0fc=_0x40a0fc[_0x91d9('0x25')](getUserApplications(_0x553352,_0x553352[_0x91d9('0x12')]));}return _0x114049['VoiceExtension'][_0x91d9('0x30')](_0x40a0fc);});}})[_0x91d9('0x23')](function(){_0x4d588c();})['catch'](function(_0x49c537){_0x4d588c(_0x49c537);});},'afterDestroy':function(_0x128455,_0x11cf4a){return _0x114049[_0x91d9('0x31')][_0x91d9('0x34')]({'where':{'UserId':_0x128455['id'],'type':'system'}});}},'instanceMethods':{'authenticate':function(_0x3fa8c9,_0x46d532){if(!_0x46d532){return this[_0x91d9('0xf')]===this[_0x91d9('0x35')](_0x3fa8c9);}var _0x1d7635=this;this[_0x91d9('0x35')](_0x3fa8c9,function(_0x3e5853,_0x4eca6f){if(_0x3e5853){_0x46d532(_0x3e5853);}if(_0x1d7635[_0x91d9('0xf')]===_0x4eca6f){_0x46d532(null,!![]);}else{_0x46d532(null,![]);}});},'makeSalt':function(_0x2e70dc,_0x42b4ec){var _0xc4165=0x10;if(typeof arguments[0x0]===_0x91d9('0x36')){_0x42b4ec=arguments[0x0];_0x2e70dc=_0xc4165;}else if(typeof arguments[0x1]===_0x91d9('0x36')){_0x42b4ec=arguments[0x1];}else{throw new Error('Missing\x20Callback');}if(!_0x2e70dc){_0x2e70dc=_0xc4165;}return crypto[_0x91d9('0x37')](_0x2e70dc,function(_0x3591ef,_0x39078a){if(_0x3591ef){_0x42b4ec(_0x3591ef);}return _0x42b4ec(null,_0x39078a['toString'](_0x91d9('0x38')));});},'encryptPassword':function(_0x2c3e0a,_0x42bc27){if(!_0x2c3e0a||!this['salt']){return _0x42bc27?_0x42bc27(null):null;}var _0x45c38f=0x2710;var _0x3b0307=0x40;var _0x414863=new Buffer(this[_0x91d9('0x39')],_0x91d9('0x38'));if(!_0x42bc27){return crypto[_0x91d9('0x3a')](_0x2c3e0a,_0x414863,_0x45c38f,_0x3b0307,_0x91d9('0x3b'))['toString']('base64');}return crypto[_0x91d9('0x3c')](_0x2c3e0a,_0x414863,_0x45c38f,_0x3b0307,_0x91d9('0x3b'),function(_0x4d2c6e,_0x1b3899){if(_0x4d2c6e){_0x42bc27(_0x4d2c6e);}return _0x42bc27(null,_0x1b3899[_0x91d9('0x3d')](_0x91d9('0x38')));});},'updatePassword':function(_0x40af7){if(!this[_0x91d9('0xf')]){return _0x40af7(null);}if(!validatePresenceOf(this[_0x91d9('0xf')])&&authTypes[_0x91d9('0x3e')](this[_0x91d9('0x3f')])===-0x1){_0x40af7(new Error(_0x91d9('0x40')));}var _0x58b6f2=this;this['makeSalt'](function(_0x177361,_0xd25a2b){if(_0x177361){return _0x40af7(_0x177361);}_0x58b6f2[_0x91d9('0x39')]=_0xd25a2b;_0x58b6f2['encryptPassword'](_0x58b6f2[_0x91d9('0xf')],function(_0xf324eb,_0x5b2fcf){if(_0xf324eb){_0x40af7(_0xf324eb);}_0x58b6f2['password']=_0x5b2fcf;_0x40af7(null);});});},'updateMd5Password':function(){this[_0x91d9('0x41')]=md5(this[_0x91d9('0x12')]+_0x91d9('0x42')+this[_0x91d9('0xf')]);return this[_0x91d9('0x41')];}}});};
\ No newline at end of file
+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