Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / api / authLocal / authLocal.controller.js
index 6d9e6a3..f365738 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb4c7=['json','online','Email\x20parameter\x20is\x20missing','generate','body','email','trim','User','find','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','resetPasswordExpires','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','Password\x20reset!','use','util','passport','passport-local','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','name','password','blockedAt','loginAttempts','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','disabled','add','clearBlockUser','minutes','getLicense','catch','blocked','MailAccount','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','\x22%s\x22\x20<%s>','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','message','test','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0x188cc8,_0xd39746){var _0x4cb155=function(_0x2d2a6c){while(--_0x2d2a6c){_0x188cc8['push'](_0x188cc8['shift']());}};_0x4cb155(++_0xd39746);}(_0xb4c7,0x19c));var _0x7b4c=function(_0x6939e9,_0x1ea346){_0x6939e9=_0x6939e9-0x0;var _0x32f2dc=_0xb4c7[_0x6939e9];return _0x32f2dc;};'use strict';var util=require(_0x7b4c('0x0'));var passport=require(_0x7b4c('0x1'));var LocalStrategy=require(_0x7b4c('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require('lodash');var rs=require('randomstring');var moment=require('moment');var db=require(_0x7b4c('0x3'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x7b4c('0x4'));var client=jayson[_0x7b4c('0x5')][_0x7b4c('0x6')]({'port':0x232b});function localAuthenticate(_0x23ef23,_0x45631a,_0x390317,_0x5905c8){var _0x236939,_0x390d28;return db[_0x7b4c('0x7')][_0x7b4c('0x8')]({'where':{'id':0x1},'attributes':[_0x7b4c('0x9'),_0x7b4c('0xa')],'raw':!![]})['then'](function(_0x1660a7){_0x236939=_0x1660a7;return _0x23ef23[_0x7b4c('0x8')]({'attributes':['id',_0x7b4c('0xb'),_0x7b4c('0xc'),'salt','role','disabled','blocked',_0x7b4c('0xd'),_0x7b4c('0xe')],'where':{'name':_0x45631a,'role':{'$or':['admin',_0x7b4c('0xf'),_0x7b4c('0x10')]}}});})[_0x7b4c('0x11')](function(_0x24ba8c){if(!_0x24ba8c||_0x24ba8c&&_0x24ba8c[_0x7b4c('0xb')]!==_0x45631a){throw new Error(_0x7b4c('0x12'));}else{_0x390d28=_0x24ba8c;return _0x390d28;}})[_0x7b4c('0x11')](function(){_0x390d28['authenticate'](_0x390317,function(_0x2061c3,_0x411f28){var _0x2ed4a9=_0x390d28[_0x7b4c('0xe')]+0x1;if(_0x2061c3){return _0x5905c8(_0x2061c3);}else if(!_0x411f28){if(_0x390d28[_0x7b4c('0x13')]){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}else if(_0x236939['allowedLoginAttempts']>0x0){if(_0x390d28['blocked']){if(_0x236939[_0x7b4c('0xa')]>0x0){if(moment(_0x390d28[_0x7b4c('0xd')])[_0x7b4c('0x14')](_0x236939[_0x7b4c('0xa')],'minutes')>moment()){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}else{return utils[_0x7b4c('0x15')](_0x390d28,_0x2ed4a9,![],null)[_0x7b4c('0x11')](function(){return _0x5905c8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}}else{if(_0x2ed4a9>=_0x236939[_0x7b4c('0x9')]){return utils[_0x7b4c('0x15')](_0x390d28,0x0,!![],moment())['then'](function(){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});});}else{return utils[_0x7b4c('0x15')](_0x390d28,_0x2ed4a9,![],null)[_0x7b4c('0x11')](function(){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});});}}}else{return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}}else{if(_0x390d28[_0x7b4c('0x13')]){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}else if(_0x236939['allowedLoginAttempts']>0x0){if(_0x390d28['blocked']){if(_0x236939[_0x7b4c('0xa')]>0x0){if(moment(_0x390d28[_0x7b4c('0xd')])[_0x7b4c('0x14')](_0x236939['blockDuration'],_0x7b4c('0x16'))>moment()){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}else{return utils[_0x7b4c('0x15')](_0x390d28,0x0,![],null)[_0x7b4c('0x11')](function(){return utils[_0x7b4c('0x17')](_0x390d28);})[_0x7b4c('0x11')](function(){return _0x5905c8(null,_0x390d28);});}}else{return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}}else{return utils[_0x7b4c('0x15')](_0x390d28,0x0,![],null)['then'](function(){return utils[_0x7b4c('0x17')](_0x390d28);})['then'](function(){return _0x5905c8(null,_0x390d28);})[_0x7b4c('0x18')](function(_0x10066c){return _0x5905c8(null,![],_0x10066c);});}}else{if(_0x390d28[_0x7b4c('0x19')]){return _0x5905c8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x7b4c('0x17')](_0x390d28)[_0x7b4c('0x11')](function(){return _0x5905c8(null,_0x390d28);});}}}});})[_0x7b4c('0x18')](function(_0x4a2b36){return _0x5905c8(null,![],_0x4a2b36);});}function sendServiceMail(_0x3b52b1){return db[_0x7b4c('0x1a')]['find']({'where':{'service':!![]},'attributes':['id',_0x7b4c('0xb'),'email'],'include':[{'model':db[_0x7b4c('0x1b')],'as':_0x7b4c('0x1c')}]})['then'](function(_0x3d6ab1){if(!_0x3d6ab1){throw new Error(_0x7b4c('0x1d'));}var _0x504695={'tls':{'rejectUnauthorized':![]}};if(_0x3d6ab1['Smtp']['service']){_0x504695[_0x7b4c('0x1e')]=_0x3d6ab1[_0x7b4c('0x1c')]['service'];}else{_0x504695[_0x7b4c('0x1f')]=_0x3d6ab1['Smtp'][_0x7b4c('0x1f')];_0x504695[_0x7b4c('0x20')]=_0x3d6ab1[_0x7b4c('0x1c')][_0x7b4c('0x20')];_0x504695[_0x7b4c('0x21')]=_0x3d6ab1[_0x7b4c('0x1c')]['secure'];}if(_0x3d6ab1[_0x7b4c('0x1c')][_0x7b4c('0x22')]){_0x504695[_0x7b4c('0x23')]={'user':_0x3d6ab1['Smtp'][_0x7b4c('0xf')],'pass':_0x3d6ab1[_0x7b4c('0x1c')][_0x7b4c('0x24')]};}var _0x5ab237={'account':_0x504695,'message':_[_0x7b4c('0x25')]({'from':util['format'](_0x7b4c('0x26'),_0x3d6ab1[_0x7b4c('0xb')],_0x3d6ab1['email']||_0x3d6ab1[_0x7b4c('0x1c')][_0x7b4c('0xf')])},_0x3b52b1)};return client['request'](_0x7b4c('0x27'),_0x5ab237);})[_0x7b4c('0x11')](function(_0x45e6db){if(_0x45e6db[_0x7b4c('0x28')]){throw new Error(util[_0x7b4c('0x29')](_0x7b4c('0x2a'),_0x45e6db[_0x7b4c('0x28')]['message']||JSON[_0x7b4c('0x2b')](_0x45e6db[_0x7b4c('0x28')])));}return!![];});}function handleError(_0x51b1af,_0x54a074,_0x309320){return _0x51b1af[_0x7b4c('0x2c')](_0x54a074||0x1f4)['send']({'message':_0x309320?_0x309320[_0x7b4c('0x2d')]||_0x309320:''});}function checkPasswordPattern(_0x3cf8a3,_0x4f44da,_0x33d650){if(_0x33d650){var _0x34f9a8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x34f9a8[_0x7b4c('0x2e')](_0x4f44da)){return _0x3cf8a3;}else{throw new Error('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3cf8a3;}}exports['login']=function(_0xf08f83,_0x301b19,_0x443277){passport[_0x7b4c('0x2f')](_0x7b4c('0x30'),function(_0x58d9f7,_0x36bf10,_0x3b9bbe){var _0x29121a=_0x58d9f7||_0x3b9bbe;if(_0x29121a){return handleError(_0x301b19,0x191,_0x29121a);}if(!_0x36bf10){return handleError(_0x301b19,0x194,{'message':_0x7b4c('0x31')});}else{var _0x5f1bd9={'payload':{'id':_0x36bf10['id'],'role':_0x36bf10['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5f1bd9)[_0x7b4c('0x11')](function(_0x118209){_0x301b19[_0x7b4c('0x32')]({'id':_0x36bf10['id'],'token':_0x118209,'statusCall':'','isAlreadyLogged':_0x36bf10[_0x7b4c('0x33')]});});}})(_0xf08f83,_0x301b19,_0x443277);};exports['forgot']=function(_0x471229,_0x3107d1,_0x3f90f7){if(!_0x471229['body']['email']){return handleError(_0x3107d1,0x1f4,{'message':_0x7b4c('0x34')});}var _0x34574c=rs[_0x7b4c('0x35')]();_0x471229[_0x7b4c('0x36')][_0x7b4c('0x37')]=_0x471229[_0x7b4c('0x36')][_0x7b4c('0x37')][_0x7b4c('0x38')]()['toLowerCase']();var _0x589000;return db['Setting'][_0x7b4c('0x8')]({'where':{'id':0x1},'attributes':[_0x7b4c('0x9'),_0x7b4c('0xa')],'raw':!![]})[_0x7b4c('0x11')](function(_0x41da3b){_0x589000=_0x41da3b;return db[_0x7b4c('0x39')][_0x7b4c('0x3a')]({'where':{'email':_0x471229[_0x7b4c('0x36')][_0x7b4c('0x37')]}});})[_0x7b4c('0x11')](function(_0x27215e){if(!_0x27215e){throw new Error(_0x7b4c('0x3b'));}if(_0x27215e[_0x7b4c('0x13')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x27215e[_0x7b4c('0x19')]){if(moment(_0x27215e[_0x7b4c('0xd')])[_0x7b4c('0x14')](_0x589000['blockDuration'],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x27215e[_0x7b4c('0x19')]=![];_0x27215e[_0x7b4c('0xd')]=null;}}_0x27215e[_0x7b4c('0x3c')]=_0x34574c;_0x27215e[_0x7b4c('0x3d')]=Date['now']()+0x36ee80;return _0x27215e[_0x7b4c('0x3e')]();})['then'](function(){return sendServiceMail({'to':_0x471229[_0x7b4c('0x36')][_0x7b4c('0x37')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x7b4c('0x3f')+_0x7b4c('0x40')+_0x471229[_0x7b4c('0x41')][_0x7b4c('0x1f')]+_0x7b4c('0x42')+_0x34574c+'\x0a\x0a'+_0x7b4c('0x43')});})[_0x7b4c('0x11')](function(){_0x3107d1[_0x7b4c('0x2c')](0xc8)[_0x7b4c('0x44')]({'message':_0x7b4c('0x45')});})[_0x7b4c('0x18')](function(_0x5bc9fe){return handleError(_0x3107d1,0x1f4,_0x5bc9fe);});};exports[_0x7b4c('0x46')]=function(_0x18bbc0,_0x29ff26,_0x249c2a){var _0x2240f3;return db[_0x7b4c('0x39')][_0x7b4c('0x3a')]({'where':{'resetPasswordToken':_0x18bbc0[_0x7b4c('0x47')][_0x7b4c('0x48')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x7b4c('0x11')](function(_0x4b6126){_0x2240f3=_0x4b6126;if(!_0x2240f3){throw new Error(_0x7b4c('0x49'));}return db['Setting'][_0x7b4c('0x8')]({'attributes':['id',_0x7b4c('0x4a')]});})[_0x7b4c('0x11')](function(_0x1f9157){return checkPasswordPattern(_0x1f9157,_0x18bbc0[_0x7b4c('0x36')]['password'],_0x1f9157[_0x7b4c('0x4a')]);})[_0x7b4c('0x11')](function(){_0x2240f3[_0x7b4c('0xc')]=_0x18bbc0[_0x7b4c('0x36')]['password'];_0x2240f3[_0x7b4c('0x3c')]=null;_0x2240f3[_0x7b4c('0x3d')]=null;return _0x2240f3[_0x7b4c('0x3e')]();})[_0x7b4c('0x11')](function(){_0x29ff26[_0x7b4c('0x2c')](0xc8)[_0x7b4c('0x44')]({'message':_0x7b4c('0x4b')});})[_0x7b4c('0x18')](function(_0x4f4ee6){return handleError(_0x29ff26,0x1f4,_0x4f4ee6);});};passport[_0x7b4c('0x4c')](new LocalStrategy({'usernameField':'name','passwordField':_0x7b4c('0xc')},function(_0x127a2f,_0x1fe74e,_0x1ab2bb){return localAuthenticate(db[_0x7b4c('0x39')],_0x127a2f,_0x1fe74e,_0x1ab2bb);}));
\ No newline at end of file
+var _0x5f98=['catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','pass','merge','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','local','role','signToken','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','status','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Password\x20reset!','use','util','passport-local','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','password','salt','disabled','blocked','blockedAt','user','agent','name','authenticate','loginAttempts','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','then','getLicense'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5f98,0x164));var _0x85f9=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x5f98[_0x2a6809];return _0x11c371;};'use strict';var util=require(_0x85f9('0x0'));var passport=require('passport');var LocalStrategy=require(_0x85f9('0x1'))['Strategy'];var jayson=require(_0x85f9('0x2'));var _=require(_0x85f9('0x3'));var rs=require('randomstring');var moment=require(_0x85f9('0x4'));var db=require(_0x85f9('0x5'))['db'];var authService=require(_0x85f9('0x6'));var utils=require('../../config/utils');var client=jayson[_0x85f9('0x7')][_0x85f9('0x8')]({'port':0x232b});function localAuthenticate(_0x297538,_0x19f258,_0x53af03,_0x108712){var _0x2a36a2,_0x5cc552;return db[_0x85f9('0x9')][_0x85f9('0xa')]({'where':{'id':0x1},'attributes':[_0x85f9('0xb'),_0x85f9('0xc')],'raw':!![]})['then'](function(_0x13c3b2){_0x2a36a2=_0x13c3b2;return _0x297538[_0x85f9('0xa')]({'attributes':['id','name',_0x85f9('0xd'),_0x85f9('0xe'),'role',_0x85f9('0xf'),_0x85f9('0x10'),_0x85f9('0x11'),'loginAttempts'],'where':{'name':_0x19f258,'role':{'$or':['admin',_0x85f9('0x12'),_0x85f9('0x13')]}}});})['then'](function(_0x106c68){if(!_0x106c68||_0x106c68&&_0x106c68[_0x85f9('0x14')]!==_0x19f258){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5cc552=_0x106c68;return _0x5cc552;}})['then'](function(){_0x5cc552[_0x85f9('0x15')](_0x53af03,function(_0x23ad33,_0x547f86){var _0x1d1ecd=_0x5cc552[_0x85f9('0x16')]+0x1;if(_0x23ad33){return _0x108712(_0x23ad33);}else if(!_0x547f86){if(_0x5cc552[_0x85f9('0xf')]){return _0x108712(null,![],{'message':_0x85f9('0x17')});}else if(_0x2a36a2[_0x85f9('0xb')]>0x0){if(_0x5cc552['blocked']){if(_0x2a36a2[_0x85f9('0xc')]>0x0){if(moment(_0x5cc552[_0x85f9('0x11')])[_0x85f9('0x18')](_0x2a36a2[_0x85f9('0xc')],_0x85f9('0x19'))>moment()){return _0x108712(null,![],{'message':_0x85f9('0x17')});}else{return utils[_0x85f9('0x1a')](_0x5cc552,_0x1d1ecd,![],null)[_0x85f9('0x1b')](function(){return _0x108712(null,![],{'message':_0x85f9('0x17')});});}}else{return _0x108712(null,![],{'message':_0x85f9('0x17')});}}else{if(_0x1d1ecd>=_0x2a36a2['allowedLoginAttempts']){return utils['clearBlockUser'](_0x5cc552,0x0,!![],moment())[_0x85f9('0x1b')](function(){return _0x108712(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x85f9('0x1a')](_0x5cc552,_0x1d1ecd,![],null)[_0x85f9('0x1b')](function(){return _0x108712(null,![],{'message':_0x85f9('0x17')});});}}}else{return _0x108712(null,![],{'message':_0x85f9('0x17')});}}else{if(_0x5cc552[_0x85f9('0xf')]){return _0x108712(null,![],{'message':_0x85f9('0x17')});}else if(_0x2a36a2[_0x85f9('0xb')]>0x0){if(_0x5cc552['blocked']){if(_0x2a36a2[_0x85f9('0xc')]>0x0){if(moment(_0x5cc552[_0x85f9('0x11')])[_0x85f9('0x18')](_0x2a36a2[_0x85f9('0xc')],_0x85f9('0x19'))>moment()){return _0x108712(null,![],{'message':_0x85f9('0x17')});}else{return utils[_0x85f9('0x1a')](_0x5cc552,0x0,![],null)[_0x85f9('0x1b')](function(){return utils[_0x85f9('0x1c')](_0x5cc552);})[_0x85f9('0x1b')](function(){return _0x108712(null,_0x5cc552);});}}else{return _0x108712(null,![],{'message':_0x85f9('0x17')});}}else{return utils['clearBlockUser'](_0x5cc552,0x0,![],null)[_0x85f9('0x1b')](function(){return utils['getLicense'](_0x5cc552);})[_0x85f9('0x1b')](function(){return _0x108712(null,_0x5cc552);})[_0x85f9('0x1d')](function(_0x22ceff){return _0x108712(null,![],_0x22ceff);});}}else{if(_0x5cc552[_0x85f9('0x10')]){return _0x108712(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x5cc552)['then'](function(){return _0x108712(null,_0x5cc552);});}}}});})[_0x85f9('0x1d')](function(_0x49e9a3){return _0x108712(null,![],_0x49e9a3);});}function sendServiceMail(_0x45b0f2){return db[_0x85f9('0x1e')][_0x85f9('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x85f9('0x14'),_0x85f9('0x20')],'include':[{'model':db[_0x85f9('0x21')],'as':_0x85f9('0x22')}]})[_0x85f9('0x1b')](function(_0x132526){if(!_0x132526){throw new Error(_0x85f9('0x23'));}var _0x3df7df={'tls':{'rejectUnauthorized':![]}};if(_0x132526[_0x85f9('0x22')][_0x85f9('0x24')]){_0x3df7df[_0x85f9('0x24')]=_0x132526[_0x85f9('0x22')][_0x85f9('0x24')];}else{_0x3df7df[_0x85f9('0x25')]=_0x132526[_0x85f9('0x22')]['host'];_0x3df7df[_0x85f9('0x26')]=_0x132526[_0x85f9('0x22')][_0x85f9('0x26')];_0x3df7df[_0x85f9('0x27')]=_0x132526[_0x85f9('0x22')]['secure'];}if(_0x132526[_0x85f9('0x22')][_0x85f9('0x28')]){_0x3df7df['auth']={'user':_0x132526[_0x85f9('0x22')][_0x85f9('0x12')],'pass':_0x132526['Smtp'][_0x85f9('0x29')]};}var _0x39f6b1={'account':_0x3df7df,'message':_[_0x85f9('0x2a')]({'from':util[_0x85f9('0x2b')](_0x85f9('0x2c'),_0x132526['name'],_0x132526[_0x85f9('0x20')]||_0x132526[_0x85f9('0x22')][_0x85f9('0x12')])},_0x45b0f2)};return client['request'](_0x85f9('0x2d'),_0x39f6b1);})[_0x85f9('0x1b')](function(_0x2f789b){if(_0x2f789b[_0x85f9('0x2e')]){throw new Error(util[_0x85f9('0x2b')](_0x85f9('0x2f'),_0x2f789b[_0x85f9('0x2e')][_0x85f9('0x30')]||JSON[_0x85f9('0x31')](_0x2f789b[_0x85f9('0x2e')])));}return!![];});}function handleError(_0x1d9bdb,_0x348bcf,_0xfd7523){return _0x1d9bdb['status'](_0x348bcf||0x1f4)[_0x85f9('0x32')]({'message':_0xfd7523?_0xfd7523[_0x85f9('0x30')]||_0xfd7523:''});}function checkPasswordPattern(_0x3c5f16,_0x2a0746,_0x1ec9ab){if(_0x1ec9ab){var _0x5524cb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5524cb['test'](_0x2a0746)){return _0x3c5f16;}else{throw new Error(_0x85f9('0x33'));}}else{return _0x3c5f16;}}exports[_0x85f9('0x34')]=function(_0x176a76,_0x470c80,_0x1c636c){passport[_0x85f9('0x15')](_0x85f9('0x35'),function(_0x29fd4d,_0xe988a4,_0x302169){var _0x38ca6a=_0x29fd4d||_0x302169;if(_0x38ca6a){return handleError(_0x470c80,0x191,_0x38ca6a);}if(!_0xe988a4){return handleError(_0x470c80,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x24bfdb={'payload':{'id':_0xe988a4['id'],'role':_0xe988a4[_0x85f9('0x36')]},'options':{'expiresIn':0x15180}};return authService[_0x85f9('0x37')](_0x24bfdb)[_0x85f9('0x1b')](function(_0x117a23){_0x470c80['json']({'id':_0xe988a4['id'],'token':_0x117a23,'statusCall':'','isAlreadyLogged':_0xe988a4['online']});});}})(_0x176a76,_0x470c80,_0x1c636c);};exports[_0x85f9('0x38')]=function(_0xd4d78f,_0x1b5a9a,_0x4b92ba){if(!_0xd4d78f['body'][_0x85f9('0x20')]){return handleError(_0x1b5a9a,0x1f4,{'message':_0x85f9('0x39')});}var _0x4870b2=rs[_0x85f9('0x3a')]();_0xd4d78f[_0x85f9('0x3b')]['email']=_0xd4d78f['body'][_0x85f9('0x20')][_0x85f9('0x3c')]()[_0x85f9('0x3d')]();var _0x3c7a45;return db[_0x85f9('0x9')][_0x85f9('0xa')]({'where':{'id':0x1},'attributes':[_0x85f9('0xb'),_0x85f9('0xc')],'raw':!![]})[_0x85f9('0x1b')](function(_0x297750){_0x3c7a45=_0x297750;return db[_0x85f9('0x3e')][_0x85f9('0x1f')]({'where':{'email':_0xd4d78f[_0x85f9('0x3b')][_0x85f9('0x20')]}});})[_0x85f9('0x1b')](function(_0x250b4f){if(!_0x250b4f){throw new Error(_0x85f9('0x3f'));}if(_0x250b4f['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x250b4f['blocked']){if(moment(_0x250b4f[_0x85f9('0x11')])['add'](_0x3c7a45[_0x85f9('0xc')],_0x85f9('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x250b4f['blocked']=![];_0x250b4f['blockedAt']=null;}}_0x250b4f[_0x85f9('0x40')]=_0x4870b2;_0x250b4f['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x250b4f[_0x85f9('0x41')]();})[_0x85f9('0x1b')](function(){return sendServiceMail({'to':_0xd4d78f[_0x85f9('0x3b')]['email'],'subject':_0x85f9('0x42'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x85f9('0x43')+'http://'+_0xd4d78f[_0x85f9('0x44')][_0x85f9('0x25')]+_0x85f9('0x45')+_0x4870b2+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x85f9('0x1b')](function(){_0x1b5a9a[_0x85f9('0x46')](0xc8)[_0x85f9('0x32')]({'message':'Reset\x20Email\x20sent!'});})[_0x85f9('0x1d')](function(_0x2213b1){return handleError(_0x1b5a9a,0x1f4,_0x2213b1);});};exports['reset']=function(_0x4ac97c,_0x31afd9,_0x191e6c){var _0x510fae;return db[_0x85f9('0x3e')][_0x85f9('0x1f')]({'where':{'resetPasswordToken':_0x4ac97c[_0x85f9('0x47')][_0x85f9('0x48')],'resetPasswordExpires':{'$gt':Date[_0x85f9('0x49')]()}}})[_0x85f9('0x1b')](function(_0x78a7e3){_0x510fae=_0x78a7e3;if(!_0x510fae){throw new Error(_0x85f9('0x4a'));}return db['Setting'][_0x85f9('0xa')]({'attributes':['id','securePassword']});})[_0x85f9('0x1b')](function(_0x4b58e6){return checkPasswordPattern(_0x4b58e6,_0x4ac97c[_0x85f9('0x3b')][_0x85f9('0xd')],_0x4b58e6['securePassword']);})[_0x85f9('0x1b')](function(){_0x510fae[_0x85f9('0xd')]=_0x4ac97c['body'][_0x85f9('0xd')];_0x510fae['resetPasswordToken']=null;_0x510fae['resetPasswordExpires']=null;return _0x510fae[_0x85f9('0x41')]();})[_0x85f9('0x1b')](function(){_0x31afd9['status'](0xc8)[_0x85f9('0x32')]({'message':_0x85f9('0x4b')});})[_0x85f9('0x1d')](function(_0x40a26e){return handleError(_0x31afd9,0x1f4,_0x40a26e);});};passport[_0x85f9('0x4c')](new LocalStrategy({'usernameField':_0x85f9('0x14'),'passwordField':_0x85f9('0xd')},function(_0x3484be,_0x16e4b8,_0x57377c){return localAuthenticate(db[_0x85f9('0x3e')],_0x3484be,_0x16e4b8,_0x57377c);}));
\ No newline at end of file