Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / user / user.model.js
index e943419..590f27e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4bc3=['Dial','SIP/%s,,tTxXU(xcally-mixmonitor-context)','SIP/%s,,tTxX','defaults','VoiceChanSpy','findAll','then','internal','concat','catch','models','User','users','utf8','utf8_bin','updatePassword','changed','updateMd5Password','bulkCreate','VoiceExtension','resolve','destroy','password','function','Missing\x20Callback','randomBytes','toString','base64','salt','sha1','indexOf','provider','Invalid\x20password','makeSalt','encryptPassword',':asterisk:','bluebird','crypto','md5','lodash','google','length','from-sip','format','%s%s','merge','Set','chanspy','push','MixMonitor','${UNIQUEID}.%s,ab','auth','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','wav','WAV','context','system','CDR(type)=internal','extensionMonitor','includes','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=%s'];(function(_0x300584,_0x51d4c5){var _0x451f29=function(_0x17d140){while(--_0x17d140){_0x300584['push'](_0x300584['shift']());}};_0x451f29(++_0x51d4c5);}(_0x4bc3,0x16e));var _0x34bc=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x4bc3[_0xaa1b3e];return _0x454d7d;};'use strict';var BPromise=require(_0x34bc('0x0'));var crypto=require(_0x34bc('0x1'));var util=require('util');var md5=require(_0x34bc('0x2'));var _=require(_0x34bc('0x3'));var attributes=require('./user.attributes');var authTypes=[_0x34bc('0x4')];var validatePresenceOf=function(_0x616014){return _0x616014&&_0x616014[_0x34bc('0x5')];};var getChanSpyApplications=function(_0x2e043e,_0x232f40,_0x2a1322){var _0x2cc9c2={'context':_0x2e043e['context']||_0x34bc('0x6'),'type':'system','isApp':![],'UserId':_0x2e043e['id']};var _0x502087=[];for(var _0x18a01c=0x0,_0x474108=0x1;_0x18a01c<_0x2a1322[_0x34bc('0x5')];_0x18a01c++,_0x474108=0x1){var _0x365e49={'exten':util[_0x34bc('0x7')](_0x34bc('0x8'),_0x2a1322[_0x18a01c]['prefix'],_0x232f40),'ChanSpyId':_0x2a1322[_0x18a01c]['id']};_0x502087['push'](_[_0x34bc('0x9')]({'app':_0x34bc('0xa'),'appdata':util[_0x34bc('0x7')]('CDR(type)=%s',_0x34bc('0xb')),'priority':_0x474108++},_0x2cc9c2,_0x365e49));if(_0x2a1322[_0x18a01c]['record']){_0x502087[_0x34bc('0xc')](_[_0x34bc('0x9')]({'app':_0x34bc('0xd'),'appdata':util['format'](_0x34bc('0xe'),_0x2a1322[_0x18a01c]['recordingFormat']),'priority':_0x474108++},_0x2cc9c2,_0x365e49));}if(_0x2a1322[_0x18a01c][_0x34bc('0xf')]){_0x502087[_0x34bc('0xc')](_[_0x34bc('0x9')]({'app':'Authenticate','appdata':_0x2a1322[_0x18a01c]['password'],'priority':_0x474108++},_0x2cc9c2,_0x365e49));}_0x502087[_0x34bc('0xc')](_['merge']({'app':_0x34bc('0x10'),'appdata':util[_0x34bc('0x7')](_0x34bc('0x11'),_0x2e043e[_0x34bc('0x12')],_0x2a1322[_0x18a01c][_0x34bc('0x13')]?_0x2a1322[_0x18a01c][_0x34bc('0x13')]['join'](''):''),'priority':_0x474108++},_0x2cc9c2,_0x365e49));if(_0x2a1322[_0x18a01c]['record']){_0x502087['push'](_[_0x34bc('0x9')]({'app':_0x34bc('0x14'),'priority':_0x474108++},_0x2cc9c2,_0x365e49));}}return _0x502087;};var getUserApplications=function(_0x30282b,_0x239e6c){var _0x567eee=[_0x34bc('0x15'),_0x34bc('0x16'),'gsm'];var _0x2b069b={'context':_0x30282b[_0x34bc('0x17')]||'from-sip','exten':_0x239e6c,'type':_0x34bc('0x18'),'isApp':![],'UserId':_0x30282b['id']};var _0x26cdec=[{'app':_0x34bc('0xa'),'appdata':_0x34bc('0x19')}];if(_0x30282b[_0x34bc('0x1a')]&&_[_0x34bc('0x1b')](_0x567eee,_0x30282b['extensionMonitor'])){_0x26cdec[_0x34bc('0xc')]({'app':_0x34bc('0xa'),'appdata':_0x34bc('0x1c')});_0x26cdec['push']({'app':'Set','appdata':util[_0x34bc('0x7')](_0x34bc('0x1d'),_0x30282b[_0x34bc('0x1a')])});_0x26cdec[_0x34bc('0xc')]({'app':_0x34bc('0x1e'),'appdata':util[_0x34bc('0x7')](_0x34bc('0x1f'),_0x30282b[_0x34bc('0x12')])});}else{_0x26cdec[_0x34bc('0xc')]({'app':_0x34bc('0x1e'),'appdata':util[_0x34bc('0x7')](_0x34bc('0x20'),_0x30282b['name'])});}_0x26cdec[_0x34bc('0xc')]({'app':'Hangup'});for(var _0x4b76c7=0x0;_0x4b76c7<_0x26cdec[_0x34bc('0x5')];_0x4b76c7++){_0x26cdec[_0x4b76c7]['priority']=_0x4b76c7+0x1;_0x26cdec[_0x4b76c7]=_[_0x34bc('0x21')](_0x26cdec[_0x4b76c7],_0x2b069b);}return _0x26cdec;};var getChanSpyPromise=function(_0x446b58,_0x46fd76){return new BPromise(function(_0x47c878,_0x2e6d96){return _0x446b58[_0x34bc('0x22')][_0x34bc('0x23')]()[_0x34bc('0x24')](function(_0x2bb874){if(_0x2bb874){var _0x33bf46=getChanSpyApplications(_0x46fd76,_0x46fd76['internal'],_0x2bb874);if(_0x46fd76[_0x34bc('0x25')]!=_0x46fd76[_0x34bc('0x12')]){_0x33bf46=_0x33bf46[_0x34bc('0x26')](getChanSpyApplications(_0x46fd76,_0x46fd76[_0x34bc('0x12')],_0x2bb874));}return _0x47c878(_0x33bf46);}return _0x47c878([]);})[_0x34bc('0x27')](function(_0xd92957){_0x2e6d96(_0xd92957);});});};module['exports']=function(_0x155e44,_0x501e47){var _0x530748=_0x155e44[_0x34bc('0x28')];return _0x155e44['define'](_0x34bc('0x29'),attributes,{'tableName':_0x34bc('0x2a'),'charset':_0x34bc('0x2b'),'collate':_0x34bc('0x2c'),'hooks':{'beforeCreate':function(_0x1b6264,_0x246c39,_0x2f0ce5){_0x1b6264['updateMd5Password']();_0x1b6264[_0x34bc('0x2d')](_0x2f0ce5);},'beforeUpdate':function(_0x3a5a74,_0xc0a30e,_0x3224c7){if(_0x3a5a74[_0x34bc('0x2e')]('password')){_0x3a5a74[_0x34bc('0x2f')]();return _0x3a5a74[_0x34bc('0x2d')](_0x3224c7);}_0x3224c7();},'afterCreate':function(_0xaaaac1,_0x493835,_0x1b0d0e){var _0x4fde97=getUserApplications(_0xaaaac1,_0xaaaac1['internal']);if(_0xaaaac1[_0x34bc('0x25')]!=_0xaaaac1[_0x34bc('0x12')]){_0x4fde97=_0x4fde97[_0x34bc('0x26')](getUserApplications(_0xaaaac1,_0xaaaac1[_0x34bc('0x12')]));}return _0x530748['VoiceExtension'][_0x34bc('0x30')](_0x4fde97)[_0x34bc('0x24')](function(){if(_0xaaaac1[_0x34bc('0xb')]){return getChanSpyPromise(_0x530748,_0xaaaac1);}})['then'](function(_0x37cd30){if(_0x37cd30&&_0x37cd30[_0x34bc('0x5')]){return _0x530748[_0x34bc('0x31')][_0x34bc('0x30')](_0x37cd30);}})['then'](function(){_0x1b0d0e();})[_0x34bc('0x27')](function(_0x1b5b91){_0x1b0d0e(_0x1b5b91);});},'afterUpdate':function(_0x25f612,_0x4ddef6,_0x246a86){return BPromise[_0x34bc('0x32')]()[_0x34bc('0x24')](function(){if(_0x25f612[_0x34bc('0x2e')](_0x34bc('0xb'))||_0x25f612['changed'](_0x34bc('0x17'))){return _0x530748[_0x34bc('0x31')][_0x34bc('0x33')]({'where':{'UserId':_0x25f612['id'],'type':_0x34bc('0x18'),'ChanSpyId':{'$ne':null}}})[_0x34bc('0x24')](function(){if(_0x25f612['chanspy']){return getChanSpyPromise(_0x530748,_0x25f612)[_0x34bc('0x24')](function(_0x50f1ee){if(_0x50f1ee&&_0x50f1ee[_0x34bc('0x5')]){return _0x530748[_0x34bc('0x31')][_0x34bc('0x30')](_0x50f1ee);}});}});}})[_0x34bc('0x24')](function(){if(_0x25f612['changed'](_0x34bc('0x1a'))||_0x25f612[_0x34bc('0x2e')]('context')){return _0x530748[_0x34bc('0x31')][_0x34bc('0x33')]({'where':{'UserId':_0x25f612['id'],'type':_0x34bc('0x18'),'ChanSpyId':null}})['then'](function(){var _0x31afd3=getUserApplications(_0x25f612,_0x25f612[_0x34bc('0x25')]);if(_0x25f612[_0x34bc('0x25')]!=_0x25f612[_0x34bc('0x12')]){_0x31afd3=_0x31afd3[_0x34bc('0x26')](getUserApplications(_0x25f612,_0x25f612[_0x34bc('0x12')]));}return _0x530748[_0x34bc('0x31')][_0x34bc('0x30')](_0x31afd3);});}})[_0x34bc('0x24')](function(){_0x246a86();})[_0x34bc('0x27')](function(_0x370c6f){_0x246a86(_0x370c6f);});},'afterDestroy':function(_0x570824,_0x4da4ec){return _0x530748[_0x34bc('0x31')][_0x34bc('0x33')]({'where':{'UserId':_0x570824['id'],'type':_0x34bc('0x18')}});}},'instanceMethods':{'authenticate':function(_0x2dd370,_0x7d6195){if(!_0x7d6195){return this[_0x34bc('0x34')]===this['encryptPassword'](_0x2dd370);}var _0x3c25a3=this;this['encryptPassword'](_0x2dd370,function(_0x3f6a2f,_0x2a21b4){if(_0x3f6a2f){_0x7d6195(_0x3f6a2f);}if(_0x3c25a3[_0x34bc('0x34')]===_0x2a21b4){_0x7d6195(null,!![]);}else{_0x7d6195(null,![]);}});},'makeSalt':function(_0x4ba4eb,_0xc57588){var _0xf7c0be=0x10;if(typeof arguments[0x0]===_0x34bc('0x35')){_0xc57588=arguments[0x0];_0x4ba4eb=_0xf7c0be;}else if(typeof arguments[0x1]===_0x34bc('0x35')){_0xc57588=arguments[0x1];}else{throw new Error(_0x34bc('0x36'));}if(!_0x4ba4eb){_0x4ba4eb=_0xf7c0be;}return crypto[_0x34bc('0x37')](_0x4ba4eb,function(_0xba179d,_0x5d10bf){if(_0xba179d){_0xc57588(_0xba179d);}return _0xc57588(null,_0x5d10bf[_0x34bc('0x38')](_0x34bc('0x39')));});},'encryptPassword':function(_0x100c70,_0xe12bd){if(!_0x100c70||!this['salt']){return _0xe12bd?_0xe12bd(null):null;}var _0x56494f=0x2710;var _0x5d1efa=0x40;var _0x14bda4=new Buffer(this[_0x34bc('0x3a')],'base64');if(!_0xe12bd){return crypto['pbkdf2Sync'](_0x100c70,_0x14bda4,_0x56494f,_0x5d1efa,_0x34bc('0x3b'))[_0x34bc('0x38')](_0x34bc('0x39'));}return crypto['pbkdf2'](_0x100c70,_0x14bda4,_0x56494f,_0x5d1efa,_0x34bc('0x3b'),function(_0x25b02e,_0x49286b){if(_0x25b02e){_0xe12bd(_0x25b02e);}return _0xe12bd(null,_0x49286b[_0x34bc('0x38')]('base64'));});},'updatePassword':function(_0x465ac8){if(!this['password']){return _0x465ac8(null);}if(!validatePresenceOf(this[_0x34bc('0x34')])&&authTypes[_0x34bc('0x3c')](this[_0x34bc('0x3d')])===-0x1){_0x465ac8(new Error(_0x34bc('0x3e')));}var _0x4d63e0=this;this[_0x34bc('0x3f')](function(_0x2bbd0b,_0x103bd1){if(_0x2bbd0b){return _0x465ac8(_0x2bbd0b);}_0x4d63e0[_0x34bc('0x3a')]=_0x103bd1;_0x4d63e0[_0x34bc('0x40')](_0x4d63e0[_0x34bc('0x34')],function(_0x18eadd,_0x20c3c7){if(_0x18eadd){_0x465ac8(_0x18eadd);}_0x4d63e0['password']=_0x20c3c7;_0x465ac8(null);});});},'updateMd5Password':function(){this['md5secret']=md5(this['name']+_0x34bc('0x41')+this[_0x34bc('0x34')]);return this['md5secret'];}}});};
\ No newline at end of file
+var _0xdd1b=['base64','salt','pbkdf2Sync','toString','pbkdf2','sha1','indexOf','provider','Invalid\x20password','makeSalt','md5secret','bluebird','crypto','util','md5','lodash','./user.attributes','length','context','from-sip','system','format','%s%s','prefix','push','merge','Set','CDR(type)=%s','record','MixMonitor','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','gsm','CDR(type)=internal','extensionMonitor','includes','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=%s','name','SIP/%s,,tTxX','Hangup','priority','defaults','VoiceChanSpy','then','internal','concat','catch','models','define','User','utf8_bin','changed','updateMd5Password','updatePassword','VoiceExtension','bulkCreate','resolve','destroy','chanspy','encryptPassword','function','randomBytes'];(function(_0x16e6ea,_0x44978e){var _0x29ae3c=function(_0x54da81){while(--_0x54da81){_0x16e6ea['push'](_0x16e6ea['shift']());}};_0x29ae3c(++_0x44978e);}(_0xdd1b,0x11f));var _0xbdd1=function(_0x419bac,_0x847e80){_0x419bac=_0x419bac-0x0;var _0x3373d4=_0xdd1b[_0x419bac];return _0x3373d4;};'use strict';var BPromise=require(_0xbdd1('0x0'));var crypto=require(_0xbdd1('0x1'));var util=require(_0xbdd1('0x2'));var md5=require(_0xbdd1('0x3'));var _=require(_0xbdd1('0x4'));var attributes=require(_0xbdd1('0x5'));var authTypes=['google'];var validatePresenceOf=function(_0x557f85){return _0x557f85&&_0x557f85[_0xbdd1('0x6')];};var getChanSpyApplications=function(_0x4e3141,_0x2881f6,_0x40de88){var _0x13befd={'context':_0x4e3141[_0xbdd1('0x7')]||_0xbdd1('0x8'),'type':_0xbdd1('0x9'),'isApp':![],'UserId':_0x4e3141['id']};var _0x3acb8a=[];for(var _0x1e4260=0x0,_0x3d74e7=0x1;_0x1e4260<_0x40de88[_0xbdd1('0x6')];_0x1e4260++,_0x3d74e7=0x1){var _0x261c13={'exten':util[_0xbdd1('0xa')](_0xbdd1('0xb'),_0x40de88[_0x1e4260][_0xbdd1('0xc')],_0x2881f6),'ChanSpyId':_0x40de88[_0x1e4260]['id']};_0x3acb8a[_0xbdd1('0xd')](_[_0xbdd1('0xe')]({'app':_0xbdd1('0xf'),'appdata':util[_0xbdd1('0xa')](_0xbdd1('0x10'),'chanspy'),'priority':_0x3d74e7++},_0x13befd,_0x261c13));if(_0x40de88[_0x1e4260][_0xbdd1('0x11')]){_0x3acb8a[_0xbdd1('0xd')](_['merge']({'app':_0xbdd1('0x12'),'appdata':util[_0xbdd1('0xa')]('${UNIQUEID}.%s,ab',_0x40de88[_0x1e4260][_0xbdd1('0x13')]),'priority':_0x3d74e7++},_0x13befd,_0x261c13));}if(_0x40de88[_0x1e4260][_0xbdd1('0x14')]){_0x3acb8a['push'](_[_0xbdd1('0xe')]({'app':'Authenticate','appdata':_0x40de88[_0x1e4260][_0xbdd1('0x15')],'priority':_0x3d74e7++},_0x13befd,_0x261c13));}_0x3acb8a[_0xbdd1('0xd')](_[_0xbdd1('0xe')]({'app':_0xbdd1('0x16'),'appdata':util['format'](_0xbdd1('0x17'),_0x4e3141['name'],_0x40de88[_0x1e4260][_0xbdd1('0x18')]?_0x40de88[_0x1e4260][_0xbdd1('0x18')][_0xbdd1('0x19')](''):''),'priority':_0x3d74e7++},_0x13befd,_0x261c13));if(_0x40de88[_0x1e4260]['record']){_0x3acb8a[_0xbdd1('0xd')](_[_0xbdd1('0xe')]({'app':_0xbdd1('0x1a'),'priority':_0x3d74e7++},_0x13befd,_0x261c13));}}return _0x3acb8a;};var getUserApplications=function(_0x29ca93,_0x90147f){var _0x565ed4=['wav','WAV',_0xbdd1('0x1b')];var _0x5e6804={'context':_0x29ca93['context']||_0xbdd1('0x8'),'exten':_0x90147f,'type':'system','isApp':![],'UserId':_0x29ca93['id']};var _0x32fbee=[{'app':_0xbdd1('0xf'),'appdata':_0xbdd1('0x1c')}];if(_0x29ca93[_0xbdd1('0x1d')]&&_[_0xbdd1('0x1e')](_0x565ed4,_0x29ca93[_0xbdd1('0x1d')])){_0x32fbee[_0xbdd1('0xd')]({'app':_0xbdd1('0xf'),'appdata':_0xbdd1('0x1f')});_0x32fbee[_0xbdd1('0xd')]({'app':_0xbdd1('0xf'),'appdata':util[_0xbdd1('0xa')](_0xbdd1('0x20'),_0x29ca93[_0xbdd1('0x1d')])});_0x32fbee[_0xbdd1('0xd')]({'app':'Dial','appdata':util[_0xbdd1('0xa')]('SIP/%s,,tTxXU(xcally-mixmonitor-context)',_0x29ca93[_0xbdd1('0x21')])});}else{_0x32fbee[_0xbdd1('0xd')]({'app':'Dial','appdata':util[_0xbdd1('0xa')](_0xbdd1('0x22'),_0x29ca93[_0xbdd1('0x21')])});}_0x32fbee[_0xbdd1('0xd')]({'app':_0xbdd1('0x23')});for(var _0xd526ac=0x0;_0xd526ac<_0x32fbee[_0xbdd1('0x6')];_0xd526ac++){_0x32fbee[_0xd526ac][_0xbdd1('0x24')]=_0xd526ac+0x1;_0x32fbee[_0xd526ac]=_[_0xbdd1('0x25')](_0x32fbee[_0xd526ac],_0x5e6804);}return _0x32fbee;};var getChanSpyPromise=function(_0x42c5db,_0x4d9ad3){return new BPromise(function(_0x5afee2,_0x1ce867){return _0x42c5db[_0xbdd1('0x26')]['findAll']()[_0xbdd1('0x27')](function(_0x196a1f){if(_0x196a1f){var _0xe88a18=getChanSpyApplications(_0x4d9ad3,_0x4d9ad3[_0xbdd1('0x28')],_0x196a1f);if(_0x4d9ad3['internal']!=_0x4d9ad3[_0xbdd1('0x21')]){_0xe88a18=_0xe88a18[_0xbdd1('0x29')](getChanSpyApplications(_0x4d9ad3,_0x4d9ad3['name'],_0x196a1f));}return _0x5afee2(_0xe88a18);}return _0x5afee2([]);})[_0xbdd1('0x2a')](function(_0x28bfe3){_0x1ce867(_0x28bfe3);});});};module['exports']=function(_0xf68510,_0x4b0017){var _0xf63ce2=_0xf68510[_0xbdd1('0x2b')];return _0xf68510[_0xbdd1('0x2c')](_0xbdd1('0x2d'),attributes,{'tableName':'users','charset':'utf8','collate':_0xbdd1('0x2e'),'hooks':{'beforeCreate':function(_0x5736d2,_0x5ea479,_0x472242){_0x5736d2['updateMd5Password']();_0x5736d2['updatePassword'](_0x472242);},'beforeUpdate':function(_0x3a8d0e,_0x495294,_0x235422){if(_0x3a8d0e[_0xbdd1('0x2f')](_0xbdd1('0x15'))){_0x3a8d0e[_0xbdd1('0x30')]();return _0x3a8d0e[_0xbdd1('0x31')](_0x235422);}_0x235422();},'afterCreate':function(_0x51f184,_0x2cd834,_0x154089){var _0x403e72=getUserApplications(_0x51f184,_0x51f184['internal']);if(_0x51f184[_0xbdd1('0x28')]!=_0x51f184[_0xbdd1('0x21')]){_0x403e72=_0x403e72[_0xbdd1('0x29')](getUserApplications(_0x51f184,_0x51f184['name']));}return _0xf63ce2[_0xbdd1('0x32')][_0xbdd1('0x33')](_0x403e72)[_0xbdd1('0x27')](function(){if(_0x51f184['chanspy']){return getChanSpyPromise(_0xf63ce2,_0x51f184);}})['then'](function(_0x2d1d33){if(_0x2d1d33&&_0x2d1d33[_0xbdd1('0x6')]){return _0xf63ce2[_0xbdd1('0x32')]['bulkCreate'](_0x2d1d33);}})[_0xbdd1('0x27')](function(){_0x154089();})[_0xbdd1('0x2a')](function(_0x259d33){_0x154089(_0x259d33);});},'afterUpdate':function(_0x24fe3f,_0xd42b4c,_0x59d094){return BPromise[_0xbdd1('0x34')]()[_0xbdd1('0x27')](function(){if(_0x24fe3f['changed']('chanspy')||_0x24fe3f[_0xbdd1('0x2f')](_0xbdd1('0x7'))){return _0xf63ce2[_0xbdd1('0x32')][_0xbdd1('0x35')]({'where':{'UserId':_0x24fe3f['id'],'type':_0xbdd1('0x9'),'ChanSpyId':{'$ne':null}}})[_0xbdd1('0x27')](function(){if(_0x24fe3f[_0xbdd1('0x36')]){return getChanSpyPromise(_0xf63ce2,_0x24fe3f)[_0xbdd1('0x27')](function(_0x1e8e14){if(_0x1e8e14&&_0x1e8e14['length']){return _0xf63ce2[_0xbdd1('0x32')][_0xbdd1('0x33')](_0x1e8e14);}});}});}})[_0xbdd1('0x27')](function(){if(_0x24fe3f[_0xbdd1('0x2f')](_0xbdd1('0x1d'))||_0x24fe3f['changed'](_0xbdd1('0x7'))){return _0xf63ce2['VoiceExtension'][_0xbdd1('0x35')]({'where':{'UserId':_0x24fe3f['id'],'type':_0xbdd1('0x9'),'ChanSpyId':null}})[_0xbdd1('0x27')](function(){var _0x6d3e22=getUserApplications(_0x24fe3f,_0x24fe3f['internal']);if(_0x24fe3f[_0xbdd1('0x28')]!=_0x24fe3f[_0xbdd1('0x21')]){_0x6d3e22=_0x6d3e22['concat'](getUserApplications(_0x24fe3f,_0x24fe3f[_0xbdd1('0x21')]));}return _0xf63ce2['VoiceExtension']['bulkCreate'](_0x6d3e22);});}})[_0xbdd1('0x27')](function(){_0x59d094();})[_0xbdd1('0x2a')](function(_0x340b1e){_0x59d094(_0x340b1e);});},'afterDestroy':function(_0x363a95,_0x125b2b){return _0xf63ce2['VoiceExtension']['destroy']({'where':{'UserId':_0x363a95['id'],'type':_0xbdd1('0x9')}});}},'instanceMethods':{'authenticate':function(_0x31d839,_0x54a29e){if(!_0x54a29e){return this[_0xbdd1('0x15')]===this[_0xbdd1('0x37')](_0x31d839);}var _0x13274f=this;this['encryptPassword'](_0x31d839,function(_0x3b8a4e,_0xd0cdcf){if(_0x3b8a4e){_0x54a29e(_0x3b8a4e);}if(_0x13274f[_0xbdd1('0x15')]===_0xd0cdcf){_0x54a29e(null,!![]);}else{_0x54a29e(null,![]);}});},'makeSalt':function(_0x300973,_0x4736c0){var _0x3ff2d5=0x10;if(typeof arguments[0x0]==='function'){_0x4736c0=arguments[0x0];_0x300973=_0x3ff2d5;}else if(typeof arguments[0x1]===_0xbdd1('0x38')){_0x4736c0=arguments[0x1];}else{throw new Error('Missing\x20Callback');}if(!_0x300973){_0x300973=_0x3ff2d5;}return crypto[_0xbdd1('0x39')](_0x300973,function(_0x2f451c,_0x524825){if(_0x2f451c){_0x4736c0(_0x2f451c);}return _0x4736c0(null,_0x524825['toString'](_0xbdd1('0x3a')));});},'encryptPassword':function(_0x424653,_0x1cbcde){if(!_0x424653||!this[_0xbdd1('0x3b')]){return _0x1cbcde?_0x1cbcde(null):null;}var _0x2b1b1a=0x2710;var _0x47a9cb=0x40;var _0x441e5e=new Buffer(this[_0xbdd1('0x3b')],_0xbdd1('0x3a'));if(!_0x1cbcde){return crypto[_0xbdd1('0x3c')](_0x424653,_0x441e5e,_0x2b1b1a,_0x47a9cb,'sha1')[_0xbdd1('0x3d')](_0xbdd1('0x3a'));}return crypto[_0xbdd1('0x3e')](_0x424653,_0x441e5e,_0x2b1b1a,_0x47a9cb,_0xbdd1('0x3f'),function(_0x28b97e,_0x26990d){if(_0x28b97e){_0x1cbcde(_0x28b97e);}return _0x1cbcde(null,_0x26990d[_0xbdd1('0x3d')](_0xbdd1('0x3a')));});},'updatePassword':function(_0x2f9774){if(!this[_0xbdd1('0x15')]){return _0x2f9774(null);}if(!validatePresenceOf(this[_0xbdd1('0x15')])&&authTypes[_0xbdd1('0x40')](this[_0xbdd1('0x41')])===-0x1){_0x2f9774(new Error(_0xbdd1('0x42')));}var _0x2bb1ef=this;this[_0xbdd1('0x43')](function(_0x52b2d1,_0x1baafb){if(_0x52b2d1){return _0x2f9774(_0x52b2d1);}_0x2bb1ef['salt']=_0x1baafb;_0x2bb1ef[_0xbdd1('0x37')](_0x2bb1ef[_0xbdd1('0x15')],function(_0x38e9a0,_0x5c45ad){if(_0x38e9a0){_0x2f9774(_0x38e9a0);}_0x2bb1ef[_0xbdd1('0x15')]=_0x5c45ad;_0x2f9774(null);});});},'updateMd5Password':function(){this[_0xbdd1('0x44')]=md5(this[_0xbdd1('0x21')]+':asterisk:'+this[_0xbdd1('0x15')]);return this[_0xbdd1('0x44')];}}});};
\ No newline at end of file