Built motion from commit (unavailable).|2.6.0
[motion2.git] / server / api / user / user.model.js
index d134d12..c404894 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3308=['sha1','pbkdf2','indexOf','provider','makeSalt','md5secret','md5','lodash','./user.attributes','google','context','from-sip','format','prefix','merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','push','Authenticate','ChanSpy','SIP/%s,%s','options','StopMixMonitor','wav','WAV','gsm','system','extensionMonitor','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=%s','Dial','SIP/%s,,tTxXU(xcally-mixmonitor-context)','name','Hangup','length','priority','defaults','VoiceChanSpy','then','internal','concat','catch','exports','models','define','User','users','utf8_bin','undefined','resolve','UserProfile','find','userProfileId','privacyEnabled','updateMd5Password','updatePassword','changed','password','VoiceExtension','bulkCreate','chanspy','destroy','encryptPassword','function','Missing\x20Callback','toString','base64','salt','pbkdf2Sync'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3308,0x12e));var _0x8330=function(_0x33bc18,_0x408de9){_0x33bc18=_0x33bc18-0x0;var _0x268ae7=_0x3308[_0x33bc18];return _0x268ae7;};'use strict';var BPromise=require('bluebird');var crypto=require('crypto');var util=require('util');var md5=require(_0x8330('0x0'));var _=require(_0x8330('0x1'));var attributes=require(_0x8330('0x2'));var authTypes=[_0x8330('0x3')];var validatePresenceOf=function(_0x508fce){return _0x508fce&&_0x508fce['length'];};var getChanSpyApplications=function(_0x28d8af,_0x1e706f,_0x9387e3){var _0x131c05={'context':_0x28d8af[_0x8330('0x4')]||_0x8330('0x5'),'type':'system','isApp':![],'UserId':_0x28d8af['id']};var _0x295526=[];for(var _0x2961c1=0x0,_0x9fcd47=0x1;_0x2961c1<_0x9387e3['length'];_0x2961c1++,_0x9fcd47=0x1){var _0x3b344a={'exten':util[_0x8330('0x6')]('%s%s',_0x9387e3[_0x2961c1][_0x8330('0x7')],_0x1e706f),'ChanSpyId':_0x9387e3[_0x2961c1]['id']};_0x295526['push'](_[_0x8330('0x8')]({'app':_0x8330('0x9'),'appdata':util['format'](_0x8330('0xa'),'chanspy'),'priority':_0x9fcd47++},_0x131c05,_0x3b344a));if(_0x9387e3[_0x2961c1][_0x8330('0xb')]){_0x295526['push'](_['merge']({'app':_0x8330('0xc'),'appdata':util['format'](_0x8330('0xd'),_0x9387e3[_0x2961c1][_0x8330('0xe')]),'priority':_0x9fcd47++},_0x131c05,_0x3b344a));}if(_0x9387e3[_0x2961c1][_0x8330('0xf')]){_0x295526[_0x8330('0x10')](_[_0x8330('0x8')]({'app':_0x8330('0x11'),'appdata':_0x9387e3[_0x2961c1]['password'],'priority':_0x9fcd47++},_0x131c05,_0x3b344a));}_0x295526['push'](_[_0x8330('0x8')]({'app':_0x8330('0x12'),'appdata':util['format'](_0x8330('0x13'),_0x28d8af['name'],_0x9387e3[_0x2961c1][_0x8330('0x14')]?_0x9387e3[_0x2961c1][_0x8330('0x14')]['join'](''):''),'priority':_0x9fcd47++},_0x131c05,_0x3b344a));if(_0x9387e3[_0x2961c1][_0x8330('0xb')]){_0x295526[_0x8330('0x10')](_[_0x8330('0x8')]({'app':_0x8330('0x15'),'priority':_0x9fcd47++},_0x131c05,_0x3b344a));}}return _0x295526;};var getUserApplications=function(_0x5e0e7b,_0x5e1183){var _0x286582=[_0x8330('0x16'),_0x8330('0x17'),_0x8330('0x18')];var _0x276066={'context':_0x5e0e7b[_0x8330('0x4')]||'from-sip','exten':_0x5e1183,'type':_0x8330('0x19'),'isApp':![],'UserId':_0x5e0e7b['id']};var _0x5c6cfa=[{'app':'Set','appdata':'CDR(type)=internal'}];if(_0x5e0e7b['extensionMonitor']&&_['includes'](_0x286582,_0x5e0e7b[_0x8330('0x1a')])){_0x5c6cfa['push']({'app':_0x8330('0x9'),'appdata':_0x8330('0x1b')});_0x5c6cfa[_0x8330('0x10')]({'app':_0x8330('0x9'),'appdata':util[_0x8330('0x6')](_0x8330('0x1c'),_0x5e0e7b[_0x8330('0x1a')])});_0x5c6cfa[_0x8330('0x10')]({'app':_0x8330('0x1d'),'appdata':util[_0x8330('0x6')](_0x8330('0x1e'),_0x5e0e7b[_0x8330('0x1f')])});}else{_0x5c6cfa[_0x8330('0x10')]({'app':_0x8330('0x1d'),'appdata':util[_0x8330('0x6')]('SIP/%s,,tTxX',_0x5e0e7b[_0x8330('0x1f')])});}_0x5c6cfa[_0x8330('0x10')]({'app':_0x8330('0x20')});for(var _0x9c95db=0x0;_0x9c95db<_0x5c6cfa[_0x8330('0x21')];_0x9c95db++){_0x5c6cfa[_0x9c95db][_0x8330('0x22')]=_0x9c95db+0x1;_0x5c6cfa[_0x9c95db]=_[_0x8330('0x23')](_0x5c6cfa[_0x9c95db],_0x276066);}return _0x5c6cfa;};var getChanSpyPromise=function(_0xf01bc5,_0x5ecfc3){return new BPromise(function(_0x937a13,_0xa81757){return _0xf01bc5[_0x8330('0x24')]['findAll']()[_0x8330('0x25')](function(_0x3aad49){if(_0x3aad49){var _0x363347=getChanSpyApplications(_0x5ecfc3,_0x5ecfc3[_0x8330('0x26')],_0x3aad49);if(_0x5ecfc3[_0x8330('0x26')]!=_0x5ecfc3[_0x8330('0x1f')]){_0x363347=_0x363347[_0x8330('0x27')](getChanSpyApplications(_0x5ecfc3,_0x5ecfc3[_0x8330('0x1f')],_0x3aad49));}return _0x937a13(_0x363347);}return _0x937a13([]);})[_0x8330('0x28')](function(_0x5f2af4){_0xa81757(_0x5f2af4);});});};module[_0x8330('0x29')]=function(_0x558b33,_0x5e4cfd){var _0x463b8a=_0x558b33[_0x8330('0x2a')];return _0x558b33[_0x8330('0x2b')](_0x8330('0x2c'),attributes,{'tableName':_0x8330('0x2d'),'charset':'utf8','collate':_0x8330('0x2e'),'hooks':{'beforeCreate':function(_0x72ad49,_0x4ac7e5,_0x2f025a){var _0x1a46f7=typeof _0x72ad49['userProfileId']===_0x8330('0x2f')?BPromise[_0x8330('0x30')](null):_0x463b8a[_0x8330('0x31')][_0x8330('0x32')]({'where':{'id':_0x72ad49[_0x8330('0x33')]}});_0x1a46f7[_0x8330('0x25')](function(_0x32a794){if(_0x32a794){_0x72ad49[_0x8330('0x34')]=_0x32a794[_0x8330('0x34')];}})['then'](function(){_0x72ad49[_0x8330('0x35')]();_0x72ad49[_0x8330('0x36')](_0x2f025a);})['catch'](function(_0x45d6a2){_0x2f025a(_0x45d6a2);});},'beforeUpdate':function(_0x1abeb3,_0x36524e,_0x242e18){Promise[_0x8330('0x30')]()[_0x8330('0x25')](function(){if(_0x1abeb3[_0x8330('0x37')]('userProfileId')===![])return;return _0x463b8a[_0x8330('0x31')][_0x8330('0x32')]({'where':{'id':_0x1abeb3[_0x8330('0x33')]}})[_0x8330('0x25')](function(_0x3c9aca){if(_0x3c9aca)_0x1abeb3[_0x8330('0x34')]=_0x3c9aca[_0x8330('0x34')];return;});})['then'](function(){if(_0x1abeb3[_0x8330('0x37')](_0x8330('0x38'))){_0x1abeb3['updateMd5Password']();return _0x1abeb3[_0x8330('0x36')](_0x242e18);}_0x242e18();})['catch'](function(_0x33ae2c){_0x242e18(_0x33ae2c);});},'afterCreate':function(_0x26100f,_0x5c8c64,_0x5c89d7){var _0x140be7=getUserApplications(_0x26100f,_0x26100f[_0x8330('0x26')]);if(_0x26100f[_0x8330('0x26')]!=_0x26100f[_0x8330('0x1f')]){_0x140be7=_0x140be7['concat'](getUserApplications(_0x26100f,_0x26100f[_0x8330('0x1f')]));}return _0x463b8a[_0x8330('0x39')][_0x8330('0x3a')](_0x140be7)['then'](function(){if(_0x26100f[_0x8330('0x3b')]){return getChanSpyPromise(_0x463b8a,_0x26100f);}})[_0x8330('0x25')](function(_0x598e17){if(_0x598e17&&_0x598e17[_0x8330('0x21')]){return _0x463b8a[_0x8330('0x39')][_0x8330('0x3a')](_0x598e17);}})[_0x8330('0x25')](function(){_0x5c89d7();})[_0x8330('0x28')](function(_0x1bfb85){_0x5c89d7(_0x1bfb85);});},'afterUpdate':function(_0x54c467,_0x126712,_0x3b7e5c){return BPromise[_0x8330('0x30')]()[_0x8330('0x25')](function(){if(_0x54c467[_0x8330('0x37')](_0x8330('0x3b'))||_0x54c467[_0x8330('0x37')](_0x8330('0x4'))){return _0x463b8a[_0x8330('0x39')]['destroy']({'where':{'UserId':_0x54c467['id'],'type':'system','ChanSpyId':{'$ne':null}}})[_0x8330('0x25')](function(){if(_0x54c467[_0x8330('0x3b')]){return getChanSpyPromise(_0x463b8a,_0x54c467)[_0x8330('0x25')](function(_0x3a4b61){if(_0x3a4b61&&_0x3a4b61[_0x8330('0x21')]){return _0x463b8a[_0x8330('0x39')][_0x8330('0x3a')](_0x3a4b61);}});}});}})['then'](function(){if(_0x54c467['changed'](_0x8330('0x1a'))||_0x54c467['changed'](_0x8330('0x4'))){return _0x463b8a[_0x8330('0x39')][_0x8330('0x3c')]({'where':{'UserId':_0x54c467['id'],'type':_0x8330('0x19'),'ChanSpyId':null}})['then'](function(){var _0x1aa161=getUserApplications(_0x54c467,_0x54c467['internal']);if(_0x54c467[_0x8330('0x26')]!=_0x54c467[_0x8330('0x1f')]){_0x1aa161=_0x1aa161[_0x8330('0x27')](getUserApplications(_0x54c467,_0x54c467['name']));}return _0x463b8a['VoiceExtension']['bulkCreate'](_0x1aa161);});}})[_0x8330('0x25')](function(){_0x3b7e5c();})['catch'](function(_0x2f7a51){_0x3b7e5c(_0x2f7a51);});},'afterDestroy':function(_0x43b182,_0x4070cd){return _0x463b8a[_0x8330('0x39')][_0x8330('0x3c')]({'where':{'UserId':_0x43b182['id'],'type':'system'}});}},'instanceMethods':{'authenticate':function(_0x9cada4,_0x283728){if(!_0x283728){return this[_0x8330('0x38')]===this['encryptPassword'](_0x9cada4);}var _0x30c184=this;this[_0x8330('0x3d')](_0x9cada4,function(_0x3280cc,_0x1ad99d){if(_0x3280cc){_0x283728(_0x3280cc);}if(_0x30c184[_0x8330('0x38')]===_0x1ad99d){_0x283728(null,!![]);}else{_0x283728(null,![]);}});},'makeSalt':function(_0x3777b8,_0x52a9e7){var _0x427246=0x10;if(typeof arguments[0x0]===_0x8330('0x3e')){_0x52a9e7=arguments[0x0];_0x3777b8=_0x427246;}else if(typeof arguments[0x1]===_0x8330('0x3e')){_0x52a9e7=arguments[0x1];}else{throw new Error(_0x8330('0x3f'));}if(!_0x3777b8){_0x3777b8=_0x427246;}return crypto['randomBytes'](_0x3777b8,function(_0x45f643,_0x155539){if(_0x45f643){_0x52a9e7(_0x45f643);}return _0x52a9e7(null,_0x155539[_0x8330('0x40')](_0x8330('0x41')));});},'encryptPassword':function(_0x3ee56a,_0x39cdd9){if(!_0x3ee56a||!this[_0x8330('0x42')]){return _0x39cdd9?_0x39cdd9(null):null;}var _0x276e2f=0x2710;var _0x30887e=0x40;var _0x340e00=new Buffer(this[_0x8330('0x42')],_0x8330('0x41'));if(!_0x39cdd9){return crypto[_0x8330('0x43')](_0x3ee56a,_0x340e00,_0x276e2f,_0x30887e,_0x8330('0x44'))[_0x8330('0x40')](_0x8330('0x41'));}return crypto[_0x8330('0x45')](_0x3ee56a,_0x340e00,_0x276e2f,_0x30887e,_0x8330('0x44'),function(_0x6f2175,_0x8fbb09){if(_0x6f2175){_0x39cdd9(_0x6f2175);}return _0x39cdd9(null,_0x8fbb09['toString'](_0x8330('0x41')));});},'updatePassword':function(_0x1a5665){if(!this[_0x8330('0x38')]){return _0x1a5665(null);}if(!validatePresenceOf(this[_0x8330('0x38')])&&authTypes[_0x8330('0x46')](this[_0x8330('0x47')])===-0x1){_0x1a5665(new Error('Invalid\x20password'));}var _0x4d8f45=this;this[_0x8330('0x48')](function(_0x16c21f,_0x27a61d){if(_0x16c21f){return _0x1a5665(_0x16c21f);}_0x4d8f45['salt']=_0x27a61d;_0x4d8f45['encryptPassword'](_0x4d8f45[_0x8330('0x38')],function(_0x46b4c4,_0xa6637a){if(_0x46b4c4){_0x1a5665(_0x46b4c4);}_0x4d8f45['password']=_0xa6637a;_0x1a5665(null);});});},'updateMd5Password':function(){this[_0x8330('0x49')]=md5(this['name']+':asterisk:'+this['password']);return this['md5secret'];}}});};
\ No newline at end of file
+var _0xc3fe=['define','User','users','utf8','utf8_bin','userProfileId','undefined','resolve','find','privacyEnabled','updateMd5Password','changed','VoiceExtension','bulkCreate','destroy','encryptPassword','function','Missing\x20Callback','randomBytes','base64','salt','pbkdf2Sync','sha1','toString','pbkdf2','indexOf','Invalid\x20password','makeSalt','md5secret',':asterisk:','bluebird','crypto','util','lodash','./user.attributes','google','length','context','from-sip','format','%s%s','push','merge','Set','CDR(type)=%s','chanspy','MixMonitor','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','wav','gsm','system','CDR(type)=internal','includes','extensionMonitor','Dial','SIP/%s,,tTxX','Hangup','priority','VoiceChanSpy','findAll','then','internal','concat','catch','exports','models'];(function(_0x3b4463,_0xbad9e6){var _0xf56412=function(_0x419a33){while(--_0x419a33){_0x3b4463['push'](_0x3b4463['shift']());}};_0xf56412(++_0xbad9e6);}(_0xc3fe,0xff));var _0xec3f=function(_0x49ef6a,_0x123736){_0x49ef6a=_0x49ef6a-0x0;var _0x2d4a95=_0xc3fe[_0x49ef6a];return _0x2d4a95;};'use strict';var BPromise=require(_0xec3f('0x0'));var crypto=require(_0xec3f('0x1'));var util=require(_0xec3f('0x2'));var md5=require('md5');var _=require(_0xec3f('0x3'));var attributes=require(_0xec3f('0x4'));var authTypes=[_0xec3f('0x5')];var validatePresenceOf=function(_0x553ad4){return _0x553ad4&&_0x553ad4[_0xec3f('0x6')];};var getChanSpyApplications=function(_0xda4641,_0x22e55b,_0x5807a9){var _0x4fb9aa={'context':_0xda4641[_0xec3f('0x7')]||_0xec3f('0x8'),'type':'system','isApp':![],'UserId':_0xda4641['id']};var _0x503775=[];for(var _0xcb8557=0x0,_0x5df7fc=0x1;_0xcb8557<_0x5807a9[_0xec3f('0x6')];_0xcb8557++,_0x5df7fc=0x1){var _0x1a79df={'exten':util[_0xec3f('0x9')](_0xec3f('0xa'),_0x5807a9[_0xcb8557]['prefix'],_0x22e55b),'ChanSpyId':_0x5807a9[_0xcb8557]['id']};_0x503775[_0xec3f('0xb')](_[_0xec3f('0xc')]({'app':_0xec3f('0xd'),'appdata':util[_0xec3f('0x9')](_0xec3f('0xe'),_0xec3f('0xf')),'priority':_0x5df7fc++},_0x4fb9aa,_0x1a79df));if(_0x5807a9[_0xcb8557]['record']){_0x503775[_0xec3f('0xb')](_[_0xec3f('0xc')]({'app':_0xec3f('0x10'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x5807a9[_0xcb8557][_0xec3f('0x11')]),'priority':_0x5df7fc++},_0x4fb9aa,_0x1a79df));}if(_0x5807a9[_0xcb8557]['auth']){_0x503775['push'](_[_0xec3f('0xc')]({'app':_0xec3f('0x12'),'appdata':_0x5807a9[_0xcb8557][_0xec3f('0x13')],'priority':_0x5df7fc++},_0x4fb9aa,_0x1a79df));}_0x503775['push'](_['merge']({'app':_0xec3f('0x14'),'appdata':util['format'](_0xec3f('0x15'),_0xda4641[_0xec3f('0x16')],_0x5807a9[_0xcb8557]['options']?_0x5807a9[_0xcb8557][_0xec3f('0x17')][_0xec3f('0x18')](''):''),'priority':_0x5df7fc++},_0x4fb9aa,_0x1a79df));if(_0x5807a9[_0xcb8557][_0xec3f('0x19')]){_0x503775[_0xec3f('0xb')](_['merge']({'app':_0xec3f('0x1a'),'priority':_0x5df7fc++},_0x4fb9aa,_0x1a79df));}}return _0x503775;};var getUserApplications=function(_0xc04d54,_0x2d338){var _0xbd6461=[_0xec3f('0x1b'),'WAV',_0xec3f('0x1c')];var _0x4bea4e={'context':_0xc04d54[_0xec3f('0x7')]||_0xec3f('0x8'),'exten':_0x2d338,'type':_0xec3f('0x1d'),'isApp':![],'UserId':_0xc04d54['id']};var _0x47b6f9=[{'app':_0xec3f('0xd'),'appdata':_0xec3f('0x1e')}];if(_0xc04d54['extensionMonitor']&&_[_0xec3f('0x1f')](_0xbd6461,_0xc04d54[_0xec3f('0x20')])){_0x47b6f9[_0xec3f('0xb')]({'app':_0xec3f('0xd'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}'});_0x47b6f9[_0xec3f('0xb')]({'app':_0xec3f('0xd'),'appdata':util[_0xec3f('0x9')]('_XCALLY_MIXMONITOR_FORMAT=%s',_0xc04d54[_0xec3f('0x20')])});_0x47b6f9['push']({'app':_0xec3f('0x21'),'appdata':util['format']('SIP/%s,,tTxXU(xcally-mixmonitor-context)',_0xc04d54[_0xec3f('0x16')])});}else{_0x47b6f9['push']({'app':_0xec3f('0x21'),'appdata':util[_0xec3f('0x9')](_0xec3f('0x22'),_0xc04d54['name'])});}_0x47b6f9[_0xec3f('0xb')]({'app':_0xec3f('0x23')});for(var _0x54bc00=0x0;_0x54bc00<_0x47b6f9['length'];_0x54bc00++){_0x47b6f9[_0x54bc00][_0xec3f('0x24')]=_0x54bc00+0x1;_0x47b6f9[_0x54bc00]=_['defaults'](_0x47b6f9[_0x54bc00],_0x4bea4e);}return _0x47b6f9;};var getChanSpyPromise=function(_0x1300a8,_0x1b3155){return new BPromise(function(_0x358fcd,_0x2eac8d){return _0x1300a8[_0xec3f('0x25')][_0xec3f('0x26')]()[_0xec3f('0x27')](function(_0x237134){if(_0x237134){var _0x56217e=getChanSpyApplications(_0x1b3155,_0x1b3155[_0xec3f('0x28')],_0x237134);if(_0x1b3155[_0xec3f('0x28')]!=_0x1b3155['name']){_0x56217e=_0x56217e[_0xec3f('0x29')](getChanSpyApplications(_0x1b3155,_0x1b3155[_0xec3f('0x16')],_0x237134));}return _0x358fcd(_0x56217e);}return _0x358fcd([]);})[_0xec3f('0x2a')](function(_0x185b20){_0x2eac8d(_0x185b20);});});};module[_0xec3f('0x2b')]=function(_0x3bab9c,_0x1f3f9a){var _0x29af36=_0x3bab9c[_0xec3f('0x2c')];return _0x3bab9c[_0xec3f('0x2d')](_0xec3f('0x2e'),attributes,{'tableName':_0xec3f('0x2f'),'charset':_0xec3f('0x30'),'collate':_0xec3f('0x31'),'hooks':{'beforeCreate':function(_0x5d6e71,_0x57982e,_0x40674e){var _0x6ac9a0=typeof _0x5d6e71[_0xec3f('0x32')]===_0xec3f('0x33')?BPromise[_0xec3f('0x34')](null):_0x29af36['UserProfile'][_0xec3f('0x35')]({'where':{'id':_0x5d6e71[_0xec3f('0x32')]}});_0x6ac9a0[_0xec3f('0x27')](function(_0x5716a6){if(_0x5716a6){_0x5d6e71['privacyEnabled']=_0x5716a6[_0xec3f('0x36')];}})['then'](function(){_0x5d6e71[_0xec3f('0x37')]();_0x5d6e71['updatePassword'](_0x40674e);})[_0xec3f('0x2a')](function(_0x53df56){_0x40674e(_0x53df56);});},'beforeUpdate':function(_0x5601e9,_0x3cce1a,_0x1871ef){Promise[_0xec3f('0x34')]()[_0xec3f('0x27')](function(){if(_0x5601e9[_0xec3f('0x38')](_0xec3f('0x32'))===![])return;return _0x29af36['UserProfile']['find']({'where':{'id':_0x5601e9[_0xec3f('0x32')]}})[_0xec3f('0x27')](function(_0x3bff24){if(_0x3bff24)_0x5601e9[_0xec3f('0x36')]=_0x3bff24[_0xec3f('0x36')];return;});})[_0xec3f('0x27')](function(){if(_0x5601e9[_0xec3f('0x38')]('password')){_0x5601e9[_0xec3f('0x37')]();return _0x5601e9['updatePassword'](_0x1871ef);}_0x1871ef();})[_0xec3f('0x2a')](function(_0x432605){_0x1871ef(_0x432605);});},'afterCreate':function(_0x2c8f59,_0x2d91db,_0x421c9e){var _0x1d56fd=getUserApplications(_0x2c8f59,_0x2c8f59[_0xec3f('0x28')]);if(_0x2c8f59[_0xec3f('0x28')]!=_0x2c8f59[_0xec3f('0x16')]){_0x1d56fd=_0x1d56fd[_0xec3f('0x29')](getUserApplications(_0x2c8f59,_0x2c8f59[_0xec3f('0x16')]));}return _0x29af36[_0xec3f('0x39')][_0xec3f('0x3a')](_0x1d56fd)['then'](function(){if(_0x2c8f59[_0xec3f('0xf')]){return getChanSpyPromise(_0x29af36,_0x2c8f59);}})[_0xec3f('0x27')](function(_0x4b416d){if(_0x4b416d&&_0x4b416d[_0xec3f('0x6')]){return _0x29af36[_0xec3f('0x39')]['bulkCreate'](_0x4b416d);}})[_0xec3f('0x27')](function(){_0x421c9e();})[_0xec3f('0x2a')](function(_0x45cc79){_0x421c9e(_0x45cc79);});},'afterUpdate':function(_0xe96e53,_0xef42fc,_0x348953){return BPromise['resolve']()[_0xec3f('0x27')](function(){if(_0xe96e53[_0xec3f('0x38')](_0xec3f('0xf'))||_0xe96e53[_0xec3f('0x38')](_0xec3f('0x7'))){return _0x29af36[_0xec3f('0x39')][_0xec3f('0x3b')]({'where':{'UserId':_0xe96e53['id'],'type':_0xec3f('0x1d'),'ChanSpyId':{'$ne':null}}})[_0xec3f('0x27')](function(){if(_0xe96e53['chanspy']){return getChanSpyPromise(_0x29af36,_0xe96e53)[_0xec3f('0x27')](function(_0x56f61b){if(_0x56f61b&&_0x56f61b[_0xec3f('0x6')]){return _0x29af36[_0xec3f('0x39')][_0xec3f('0x3a')](_0x56f61b);}});}});}})[_0xec3f('0x27')](function(){if(_0xe96e53[_0xec3f('0x38')](_0xec3f('0x20'))||_0xe96e53[_0xec3f('0x38')](_0xec3f('0x7'))){return _0x29af36[_0xec3f('0x39')][_0xec3f('0x3b')]({'where':{'UserId':_0xe96e53['id'],'type':_0xec3f('0x1d'),'ChanSpyId':null}})[_0xec3f('0x27')](function(){var _0x54dbd8=getUserApplications(_0xe96e53,_0xe96e53[_0xec3f('0x28')]);if(_0xe96e53[_0xec3f('0x28')]!=_0xe96e53['name']){_0x54dbd8=_0x54dbd8[_0xec3f('0x29')](getUserApplications(_0xe96e53,_0xe96e53[_0xec3f('0x16')]));}return _0x29af36[_0xec3f('0x39')][_0xec3f('0x3a')](_0x54dbd8);});}})['then'](function(){_0x348953();})['catch'](function(_0x1fa985){_0x348953(_0x1fa985);});},'afterDestroy':function(_0x387486,_0x560791){return _0x29af36[_0xec3f('0x39')][_0xec3f('0x3b')]({'where':{'UserId':_0x387486['id'],'type':_0xec3f('0x1d')}});}},'instanceMethods':{'authenticate':function(_0x5913be,_0x377ff7){if(!_0x377ff7){return this['password']===this['encryptPassword'](_0x5913be);}var _0x502ea0=this;this[_0xec3f('0x3c')](_0x5913be,function(_0x1b7cf6,_0x316870){if(_0x1b7cf6){_0x377ff7(_0x1b7cf6);}if(_0x502ea0[_0xec3f('0x13')]===_0x316870){_0x377ff7(null,!![]);}else{_0x377ff7(null,![]);}});},'makeSalt':function(_0x580a08,_0x10f1ab){var _0x54673e=0x10;if(typeof arguments[0x0]===_0xec3f('0x3d')){_0x10f1ab=arguments[0x0];_0x580a08=_0x54673e;}else if(typeof arguments[0x1]===_0xec3f('0x3d')){_0x10f1ab=arguments[0x1];}else{throw new Error(_0xec3f('0x3e'));}if(!_0x580a08){_0x580a08=_0x54673e;}return crypto[_0xec3f('0x3f')](_0x580a08,function(_0x21cdcf,_0x3eab3f){if(_0x21cdcf){_0x10f1ab(_0x21cdcf);}return _0x10f1ab(null,_0x3eab3f['toString'](_0xec3f('0x40')));});},'encryptPassword':function(_0x56e5c2,_0x1735cf){if(!_0x56e5c2||!this['salt']){return _0x1735cf?_0x1735cf(null):null;}var _0x425d90=0x2710;var _0x4aad25=0x40;var _0x322d5e=new Buffer(this[_0xec3f('0x41')],_0xec3f('0x40'));if(!_0x1735cf){return crypto[_0xec3f('0x42')](_0x56e5c2,_0x322d5e,_0x425d90,_0x4aad25,_0xec3f('0x43'))[_0xec3f('0x44')](_0xec3f('0x40'));}return crypto[_0xec3f('0x45')](_0x56e5c2,_0x322d5e,_0x425d90,_0x4aad25,'sha1',function(_0x230aad,_0x94ff1e){if(_0x230aad){_0x1735cf(_0x230aad);}return _0x1735cf(null,_0x94ff1e['toString'](_0xec3f('0x40')));});},'updatePassword':function(_0x513508){if(!this[_0xec3f('0x13')]){return _0x513508(null);}if(!validatePresenceOf(this['password'])&&authTypes[_0xec3f('0x46')](this['provider'])===-0x1){_0x513508(new Error(_0xec3f('0x47')));}var _0x4bdd98=this;this[_0xec3f('0x48')](function(_0x6b0d78,_0x276d7e){if(_0x6b0d78){return _0x513508(_0x6b0d78);}_0x4bdd98[_0xec3f('0x41')]=_0x276d7e;_0x4bdd98[_0xec3f('0x3c')](_0x4bdd98[_0xec3f('0x13')],function(_0x5e0964,_0xbf9981){if(_0x5e0964){_0x513508(_0x5e0964);}_0x4bdd98['password']=_0xbf9981;_0x513508(null);});});},'updateMd5Password':function(){this[_0xec3f('0x49')]=md5(this[_0xec3f('0x16')]+_0xec3f('0x4a')+this[_0xec3f('0x13')]);return this[_0xec3f('0x49')];}}});};
\ No newline at end of file