Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / authLocal / authLocal.controller.js
index cf2d621..863862a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x331d=['clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','getSmtpOptions','merge','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','send','message','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','Email\x20parameter\x20is\x20missing','generate','body','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','resetPasswordToken','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','findOne','allowedLoginAttempts','blockDuration','then','name','role','disabled','blocked','blockedAt','loginAttempts','user','agent','authenticate','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x415603,_0x21320c){var _0x131e72=function(_0x50092a){while(--_0x50092a){_0x415603['push'](_0x415603['shift']());}};_0x131e72(++_0x21320c);}(_0x331d,0x1bb));var _0xd331=function(_0x3c3dd2,_0x10266e){_0x3c3dd2=_0x3c3dd2-0x0;var _0x3500cf=_0x331d[_0x3c3dd2];return _0x3500cf;};'use strict';var util=require(_0xd331('0x0'));var passport=require('passport');var LocalStrategy=require(_0xd331('0x1'))[_0xd331('0x2')];var jayson=require(_0xd331('0x3'));var _=require(_0xd331('0x4'));var rs=require(_0xd331('0x5'));var moment=require('moment');var db=require(_0xd331('0x6'))['db'];var authService=require(_0xd331('0x7'));var utils=require(_0xd331('0x8'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x1a6959,_0x4e6775,_0x363d40,_0x253891){var _0x42298c,_0x24bc76;return db['Setting'][_0xd331('0x9')]({'where':{'id':0x1},'attributes':[_0xd331('0xa'),_0xd331('0xb')],'raw':!![]})[_0xd331('0xc')](function(_0x61524a){_0x42298c=_0x61524a;return _0x1a6959[_0xd331('0x9')]({'attributes':['id',_0xd331('0xd'),'password','salt',_0xd331('0xe'),_0xd331('0xf'),_0xd331('0x10'),_0xd331('0x11'),_0xd331('0x12')],'where':{'name':_0x4e6775,'role':{'$or':['admin',_0xd331('0x13'),_0xd331('0x14')]}}});})[_0xd331('0xc')](function(_0x3ad8cf){if(!_0x3ad8cf||_0x3ad8cf&&_0x3ad8cf[_0xd331('0xd')]!==_0x4e6775){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x24bc76=_0x3ad8cf;return _0x24bc76;}})[_0xd331('0xc')](function(){_0x24bc76[_0xd331('0x15')](_0x363d40,function(_0x3da58e,_0x188372){var _0x5324e3=_0x24bc76[_0xd331('0x12')]+0x1;if(_0x3da58e){return _0x253891(_0x3da58e);}else if(!_0x188372){if(_0x24bc76[_0xd331('0xf')]){return _0x253891(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x42298c[_0xd331('0xa')]>0x0){if(_0x24bc76[_0xd331('0x10')]){if(_0x42298c[_0xd331('0xb')]>0x0){if(moment(_0x24bc76[_0xd331('0x11')])[_0xd331('0x16')](_0x42298c['blockDuration'],_0xd331('0x17'))>moment()){return _0x253891(null,![],{'message':_0xd331('0x18')});}else{return utils[_0xd331('0x19')](_0x24bc76,_0x5324e3,![],null)['then'](function(){return _0x253891(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x253891(null,![],{'message':_0xd331('0x18')});}}else{if(_0x5324e3>=_0x42298c[_0xd331('0xa')]){return utils[_0xd331('0x19')](_0x24bc76,0x0,!![],moment())['then'](function(){return _0x253891(null,![],{'message':_0xd331('0x18')});});}else{return utils['clearBlockUser'](_0x24bc76,_0x5324e3,![],null)[_0xd331('0xc')](function(){return _0x253891(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x253891(null,![],{'message':_0xd331('0x18')});}}else{if(_0x24bc76['disabled']){return _0x253891(null,![],{'message':_0xd331('0x18')});}else if(_0x42298c[_0xd331('0xa')]>0x0){if(_0x24bc76[_0xd331('0x10')]){if(_0x42298c['blockDuration']>0x0){if(moment(_0x24bc76[_0xd331('0x11')])[_0xd331('0x16')](_0x42298c[_0xd331('0xb')],_0xd331('0x17'))>moment()){return _0x253891(null,![],{'message':_0xd331('0x18')});}else{return utils[_0xd331('0x19')](_0x24bc76,0x0,![],null)[_0xd331('0xc')](function(){return utils['getLicense'](_0x24bc76);})[_0xd331('0xc')](function(){return _0x253891(null,_0x24bc76);});}}else{return _0x253891(null,![],{'message':_0xd331('0x18')});}}else{return utils[_0xd331('0x19')](_0x24bc76,0x0,![],null)[_0xd331('0xc')](function(){return utils[_0xd331('0x1a')](_0x24bc76);})['then'](function(){return _0x253891(null,_0x24bc76);})[_0xd331('0x1b')](function(_0x53dea2){return _0x253891(null,![],_0x53dea2);});}}else{if(_0x24bc76[_0xd331('0x10')]){return _0x253891(null,![],{'message':_0xd331('0x18')});}else{return utils[_0xd331('0x1a')](_0x24bc76)[_0xd331('0xc')](function(){return _0x253891(null,_0x24bc76);});}}}});})['catch'](function(_0x1d007e){return _0x253891(null,![],_0x1d007e);});}function sendServiceMail(_0x4b4d41){return db[_0xd331('0x1c')][_0xd331('0x1d')]({'where':{'service':!![]},'attributes':['id','name',_0xd331('0x1e')],'include':[{'model':db['MailServerOut'],'as':_0xd331('0x1f'),'include':[{'model':db[_0xd331('0x20')],'as':_0xd331('0x20')}]}]})[_0xd331('0xc')](function(_0x4a4808){if(!_0x4a4808){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x4bdd4f=_0x4a4808[_0xd331('0x21')]();var _0x1b02b0={'account':_0x4bdd4f,'message':_[_0xd331('0x22')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x4a4808['name'],_0x4a4808[_0xd331('0x1e')]||_0x4a4808[_0xd331('0x1f')]['user'])},_0x4b4d41)};return client[_0xd331('0x23')](_0xd331('0x24'),_0x1b02b0);})[_0xd331('0xc')](function(_0x145ecf){if(_0x145ecf[_0xd331('0x25')]){throw new Error(util[_0xd331('0x26')](_0xd331('0x27'),_0x145ecf[_0xd331('0x25')]['message']||JSON[_0xd331('0x28')](_0x145ecf[_0xd331('0x25')])));}return!![];});}function handleError(_0x118004,_0x440a18,_0x4abebc){return _0x118004['status'](_0x440a18||0x1f4)[_0xd331('0x29')]({'message':_0x4abebc?_0x4abebc[_0xd331('0x2a')]||_0x4abebc:''});}exports['login']=function(_0x594622,_0x1f250a,_0x2a7206){passport[_0xd331('0x15')](_0xd331('0x2b'),function(_0x4d5174,_0x2e6194,_0x385564){var _0x411329=_0x4d5174||_0x385564;if(_0x411329){return handleError(_0x1f250a,0x191,_0x411329);}if(!_0x2e6194){return handleError(_0x1f250a,0x194,{'message':_0xd331('0x2c')});}else{var _0x468267={'payload':{'id':_0x2e6194['id'],'role':_0x2e6194[_0xd331('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0xd331('0x2d')](_0x468267)[_0xd331('0xc')](function(_0x5dced3){_0x1f250a[_0xd331('0x2e')]({'id':_0x2e6194['id'],'token':_0x5dced3,'statusCall':'','isAlreadyLogged':_0x2e6194['online']});});}})(_0x594622,_0x1f250a,_0x2a7206);};exports[_0xd331('0x2f')]=function(_0xf18aaa,_0x4430b5){if(!_0xf18aaa['body'][_0xd331('0x1e')]){return handleError(_0x4430b5,0x1f4,{'message':_0xd331('0x30')});}var _0x1e9044=rs[_0xd331('0x31')]();_0xf18aaa[_0xd331('0x32')][_0xd331('0x1e')]=_0xf18aaa[_0xd331('0x32')]['email']['trim']()[_0xd331('0x33')]();var _0x5e35ea;return db[_0xd331('0x34')][_0xd331('0x9')]({'where':{'id':0x1},'attributes':[_0xd331('0xa'),'blockDuration'],'raw':!![]})[_0xd331('0xc')](function(_0x4cf889){_0x5e35ea=_0x4cf889;return db[_0xd331('0x35')][_0xd331('0x1d')]({'where':{'email':_0xf18aaa[_0xd331('0x32')][_0xd331('0x1e')]}});})[_0xd331('0xc')](function(_0x16b208){if(!_0x16b208){throw new Error(_0xd331('0x36'));}if(_0x16b208[_0xd331('0xf')]){throw new Error(_0xd331('0x37'));}if(_0x16b208[_0xd331('0x10')]){if(moment(_0x16b208['blockedAt'])['add'](_0x5e35ea[_0xd331('0xb')],_0xd331('0x17'))>moment()){throw new Error(_0xd331('0x38'));}else{_0x16b208[_0xd331('0x10')]=![];_0x16b208[_0xd331('0x11')]=null;}}_0x16b208['resetPasswordToken']=_0x1e9044;_0x16b208[_0xd331('0x39')]=Date[_0xd331('0x3a')]()+0x36ee80;return _0x16b208[_0xd331('0x3b')]();})[_0xd331('0xc')](function(){return sendServiceMail({'to':_0xf18aaa[_0xd331('0x32')][_0xd331('0x1e')],'subject':_0xd331('0x3c'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xd331('0x3d')+'https://'+_0xf18aaa['headers']['host']+'/reset/'+_0x1e9044+'\x0a\x0a'+_0xd331('0x3e')});})['then'](function(){_0x4430b5[_0xd331('0x3f')](0xc8)[_0xd331('0x29')]({'message':_0xd331('0x40')});})[_0xd331('0x1b')](function(_0x56a4f9){return handleError(_0x4430b5,0x1f4,_0x56a4f9);});};exports[_0xd331('0x41')]=function(_0x3b5c0b,_0x517f7e){return db[_0xd331('0x35')][_0xd331('0x1d')]({'where':{'resetPasswordToken':_0x3b5c0b[_0xd331('0x42')][_0xd331('0x43')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xd331('0xc')](function(_0x2fb963){if(!_0x2fb963){throw new Error(_0xd331('0x44'));}return db[_0xd331('0x34')][_0xd331('0x9')]({'attributes':['id',_0xd331('0x45'),'enforcePasswordHistory',_0xd331('0x46')]})[_0xd331('0xc')](function(_0xd9f1a1){if(_0xd9f1a1[_0xd331('0x45')])authService[_0xd331('0x47')](_0x3b5c0b[_0xd331('0x32')][_0xd331('0x48')]);if(!_0xd9f1a1['enforcePasswordHistory']||!_0x2fb963[_0xd331('0x49')])return _0x2fb963;authService[_0xd331('0x4a')](_0x3b5c0b[_0xd331('0x32')][_0xd331('0x48')],_0x2fb963[_0xd331('0x49')],_0xd9f1a1['passwordHistoryLimit']);return _0x2fb963;})[_0xd331('0xc')](function(){_0x2fb963['password']=_0x3b5c0b[_0xd331('0x32')][_0xd331('0x48')];_0x2fb963[_0xd331('0x4b')]=null;_0x2fb963['resetPasswordExpires']=null;return _0x2fb963[_0xd331('0x3b')]();});})['then'](function(){_0x517f7e[_0xd331('0x3f')](0xc8)[_0xd331('0x29')]({'message':_0xd331('0x4c')});})['catch'](function(_0x20ce85){return handleError(_0x517f7e,0x1f4,_0x20ce85);});};passport[_0xd331('0x4d')](_0xd331('0x2b'),new LocalStrategy({'usernameField':_0xd331('0xd'),'passwordField':_0xd331('0x48')},function(_0x271898,_0x375e4d,_0x17c5af){return localAuthenticate(db[_0xd331('0x35')],_0x271898,_0x375e4d,_0x17c5af);}));
\ No newline at end of file
+var _0xf022=['getLicense','catch','MailAccount','find','email','CloudProvider','merge','format','\x22%s\x22\x20<%s>','Smtp','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','securePassword','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','use','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','blockDuration','then','findOne','password','salt','role','disabled','blocked','blockedAt','loginAttempts','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','minutes','clearBlockUser'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xf022,0x8c));var _0x2f02=function(_0x4e11d5,_0x1ce514){_0x4e11d5=_0x4e11d5-0x0;var _0x5e4e4c=_0xf022[_0x4e11d5];return _0x5e4e4c;};'use strict';var util=require('util');var passport=require(_0x2f02('0x0'));var LocalStrategy=require(_0x2f02('0x1'))[_0x2f02('0x2')];var jayson=require(_0x2f02('0x3'));var _=require(_0x2f02('0x4'));var rs=require(_0x2f02('0x5'));var moment=require(_0x2f02('0x6'));var db=require(_0x2f02('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x2f02('0x8'));var client=jayson[_0x2f02('0x9')][_0x2f02('0xa')]({'port':0x232b});function localAuthenticate(_0x382e08,_0x744216,_0x35cdf5,_0x2931a0){var _0xab50e2,_0x4ead79;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x2f02('0xb')],'raw':!![]})[_0x2f02('0xc')](function(_0x48ee87){_0xab50e2=_0x48ee87;return _0x382e08[_0x2f02('0xd')]({'attributes':['id','name',_0x2f02('0xe'),_0x2f02('0xf'),_0x2f02('0x10'),_0x2f02('0x11'),_0x2f02('0x12'),_0x2f02('0x13'),_0x2f02('0x14')],'where':{'name':_0x744216,'role':{'$or':['admin','user',_0x2f02('0x15')]}}});})[_0x2f02('0xc')](function(_0x20a44d){if(!_0x20a44d||_0x20a44d&&_0x20a44d[_0x2f02('0x16')]!==_0x744216){throw new Error(_0x2f02('0x17'));}else{_0x4ead79=_0x20a44d;return _0x4ead79;}})[_0x2f02('0xc')](function(){_0x4ead79['authenticate'](_0x35cdf5,function(_0x4c482e,_0x20b6a0){var _0x326978=_0x4ead79[_0x2f02('0x14')]+0x1;if(_0x4c482e){return _0x2931a0(_0x4c482e);}else if(!_0x20b6a0){if(_0x4ead79[_0x2f02('0x11')]){return _0x2931a0(null,![],{'message':_0x2f02('0x17')});}else if(_0xab50e2[_0x2f02('0x18')]>0x0){if(_0x4ead79[_0x2f02('0x12')]){if(_0xab50e2[_0x2f02('0xb')]>0x0){if(moment(_0x4ead79[_0x2f02('0x13')])[_0x2f02('0x19')](_0xab50e2[_0x2f02('0xb')],_0x2f02('0x1a'))>moment()){return _0x2931a0(null,![],{'message':_0x2f02('0x17')});}else{return utils[_0x2f02('0x1b')](_0x4ead79,_0x326978,![],null)[_0x2f02('0xc')](function(){return _0x2931a0(null,![],{'message':_0x2f02('0x17')});});}}else{return _0x2931a0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x326978>=_0xab50e2[_0x2f02('0x18')]){return utils[_0x2f02('0x1b')](_0x4ead79,0x0,!![],moment())[_0x2f02('0xc')](function(){return _0x2931a0(null,![],{'message':_0x2f02('0x17')});});}else{return utils[_0x2f02('0x1b')](_0x4ead79,_0x326978,![],null)['then'](function(){return _0x2931a0(null,![],{'message':_0x2f02('0x17')});});}}}else{return _0x2931a0(null,![],{'message':_0x2f02('0x17')});}}else{if(_0x4ead79[_0x2f02('0x11')]){return _0x2931a0(null,![],{'message':_0x2f02('0x17')});}else if(_0xab50e2[_0x2f02('0x18')]>0x0){if(_0x4ead79[_0x2f02('0x12')]){if(_0xab50e2[_0x2f02('0xb')]>0x0){if(moment(_0x4ead79[_0x2f02('0x13')])[_0x2f02('0x19')](_0xab50e2[_0x2f02('0xb')],_0x2f02('0x1a'))>moment()){return _0x2931a0(null,![],{'message':_0x2f02('0x17')});}else{return utils[_0x2f02('0x1b')](_0x4ead79,0x0,![],null)['then'](function(){return utils['getLicense'](_0x4ead79);})[_0x2f02('0xc')](function(){return _0x2931a0(null,_0x4ead79);});}}else{return _0x2931a0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x4ead79,0x0,![],null)['then'](function(){return utils[_0x2f02('0x1c')](_0x4ead79);})['then'](function(){return _0x2931a0(null,_0x4ead79);})[_0x2f02('0x1d')](function(_0x309110){return _0x2931a0(null,![],_0x309110);});}}else{if(_0x4ead79[_0x2f02('0x12')]){return _0x2931a0(null,![],{'message':_0x2f02('0x17')});}else{return utils[_0x2f02('0x1c')](_0x4ead79)[_0x2f02('0xc')](function(){return _0x2931a0(null,_0x4ead79);});}}}});})[_0x2f02('0x1d')](function(_0x36fe48){return _0x2931a0(null,![],_0x36fe48);});}function sendServiceMail(_0x21cd26){return db[_0x2f02('0x1e')][_0x2f02('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x2f02('0x16'),_0x2f02('0x20')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x2f02('0x21')],'as':'CloudProvider'}]}]})['then'](function(_0x3169ec){if(!_0x3169ec){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x1d8626=_0x3169ec['getSmtpOptions']();var _0x41727a={'account':_0x1d8626,'message':_[_0x2f02('0x22')]({'from':util[_0x2f02('0x23')](_0x2f02('0x24'),_0x3169ec[_0x2f02('0x16')],_0x3169ec[_0x2f02('0x20')]||_0x3169ec[_0x2f02('0x25')][_0x2f02('0x26')])},_0x21cd26)};return client[_0x2f02('0x27')](_0x2f02('0x28'),_0x41727a);})[_0x2f02('0xc')](function(_0xe88c95){if(_0xe88c95[_0x2f02('0x29')]){throw new Error(util[_0x2f02('0x23')](_0x2f02('0x2a'),_0xe88c95[_0x2f02('0x29')][_0x2f02('0x2b')]||JSON[_0x2f02('0x2c')](_0xe88c95['error'])));}return!![];});}function handleError(_0x51865e,_0x50c1c1,_0x177fa2){return _0x51865e[_0x2f02('0x2d')](_0x50c1c1||0x1f4)[_0x2f02('0x2e')]({'message':_0x177fa2?_0x177fa2[_0x2f02('0x2b')]||_0x177fa2:''});}exports[_0x2f02('0x2f')]=function(_0xeac591,_0x48ee09,_0x3b1892){passport[_0x2f02('0x30')](_0x2f02('0x31'),function(_0x4ef107,_0x17c58b,_0x11d17a){var _0x5b03e1=_0x4ef107||_0x11d17a;if(_0x5b03e1){return handleError(_0x48ee09,0x191,_0x5b03e1);}if(!_0x17c58b){return handleError(_0x48ee09,0x194,{'message':_0x2f02('0x32')});}else{var _0x487d26={'payload':{'id':_0x17c58b['id'],'role':_0x17c58b[_0x2f02('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x2f02('0x33')](_0x487d26)['then'](function(_0x201998){_0x48ee09[_0x2f02('0x34')]({'id':_0x17c58b['id'],'token':_0x201998,'statusCall':'','isAlreadyLogged':_0x17c58b[_0x2f02('0x35')]});});}})(_0xeac591,_0x48ee09,_0x3b1892);};exports[_0x2f02('0x36')]=function(_0x11b9b2,_0xab745){if(!_0x11b9b2[_0x2f02('0x37')]['email']){return handleError(_0xab745,0x1f4,{'message':_0x2f02('0x38')});}var _0x34076c=rs[_0x2f02('0x39')]();_0x11b9b2[_0x2f02('0x37')][_0x2f02('0x20')]=_0x11b9b2[_0x2f02('0x37')][_0x2f02('0x20')][_0x2f02('0x3a')]()[_0x2f02('0x3b')]();var _0x220ef3;return db[_0x2f02('0x3c')]['findOne']({'where':{'id':0x1},'attributes':[_0x2f02('0x18'),_0x2f02('0xb')],'raw':!![]})[_0x2f02('0xc')](function(_0x5e49fe){_0x220ef3=_0x5e49fe;return db[_0x2f02('0x3d')][_0x2f02('0x1f')]({'where':{'email':_0x11b9b2[_0x2f02('0x37')][_0x2f02('0x20')]}});})[_0x2f02('0xc')](function(_0x3052a9){if(!_0x3052a9){throw new Error(_0x2f02('0x3e'));}if(_0x3052a9[_0x2f02('0x11')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x3052a9[_0x2f02('0x12')]){if(moment(_0x3052a9[_0x2f02('0x13')])['add'](_0x220ef3[_0x2f02('0xb')],_0x2f02('0x1a'))>moment()){throw new Error(_0x2f02('0x3f'));}else{_0x3052a9[_0x2f02('0x12')]=![];_0x3052a9[_0x2f02('0x13')]=null;}}_0x3052a9[_0x2f02('0x40')]=_0x34076c;_0x3052a9[_0x2f02('0x41')]=Date[_0x2f02('0x42')]()+0x36ee80;return _0x3052a9[_0x2f02('0x43')]();})[_0x2f02('0xc')](function(){return sendServiceMail({'to':_0x11b9b2['body'][_0x2f02('0x20')],'subject':_0x2f02('0x44'),'text':_0x2f02('0x45')+_0x2f02('0x46')+_0x2f02('0x47')+_0x11b9b2['headers']['host']+_0x2f02('0x48')+_0x34076c+'\x0a\x0a'+_0x2f02('0x49')});})['then'](function(){_0xab745[_0x2f02('0x2d')](0xc8)[_0x2f02('0x2e')]({'message':_0x2f02('0x4a')});})[_0x2f02('0x1d')](function(_0x5698f7){return handleError(_0xab745,0x1f4,_0x5698f7);});};exports[_0x2f02('0x4b')]=function(_0x405bc9,_0x5d6367){return db[_0x2f02('0x3d')][_0x2f02('0x1f')]({'where':{'resetPasswordToken':_0x405bc9[_0x2f02('0x4c')]['token'],'resetPasswordExpires':{'$gt':Date[_0x2f02('0x42')]()}}})['then'](function(_0x1eb96a){if(!_0x1eb96a){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x2f02('0xd')]({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})['then'](function(_0x496f9d){if(_0x496f9d[_0x2f02('0x4d')])authService[_0x2f02('0x4e')](_0x405bc9[_0x2f02('0x37')][_0x2f02('0xe')]);if(!_0x496f9d[_0x2f02('0x4f')]||!_0x1eb96a[_0x2f02('0x50')])return _0x1eb96a;authService[_0x2f02('0x51')](_0x405bc9['body'][_0x2f02('0xe')],_0x1eb96a[_0x2f02('0x50')],_0x496f9d[_0x2f02('0x52')]);return _0x1eb96a;})[_0x2f02('0xc')](function(){_0x1eb96a[_0x2f02('0xe')]=_0x405bc9['body'][_0x2f02('0xe')];_0x1eb96a[_0x2f02('0x40')]=null;_0x1eb96a['resetPasswordExpires']=null;return _0x1eb96a[_0x2f02('0x43')]();});})[_0x2f02('0xc')](function(){_0x5d6367[_0x2f02('0x2d')](0xc8)[_0x2f02('0x2e')]({'message':'Password\x20reset!'});})[_0x2f02('0x1d')](function(_0x5cc2dc){return handleError(_0x5d6367,0x1f4,_0x5cc2dc);});};passport[_0x2f02('0x53')](_0x2f02('0x31'),new LocalStrategy({'usernameField':_0x2f02('0x16'),'passwordField':_0x2f02('0xe')},function(_0x231e56,_0x38021f,_0x11a725){return localAuthenticate(db[_0x2f02('0x3d')],_0x231e56,_0x38021f,_0x11a725);}));
\ No newline at end of file