Built motion from commit 1fa89557.|2.6.10
[motion2.git] / server / api / authGoogle / authGoogle.controller.js
index 78c68f3..4ed9a34 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc2d5=['allowedLoginAttempts','then','User','find','map','admin','agent','disabled','blockDuration','blocked','blockedAt','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','login','authenticate','google','email','callback','/login','use','secret','callbackURL','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2d5,0x1ca));var _0x5c2d=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0xc2d5[_0x251d9c];return _0x16ae64;};'use strict';var _=require(_0x5c2d('0x0'));var passport=require(_0x5c2d('0x1'));var GoogleStrategy=require(_0x5c2d('0x2'))[_0x5c2d('0x3')];var moment=require('moment');var db=require(_0x5c2d('0x4'))['db'];var config=require(_0x5c2d('0x5'));var signToken=require(_0x5c2d('0x6'))['signToken'];var utils=require(_0x5c2d('0x7'));exports[_0x5c2d('0x8')]=passport[_0x5c2d('0x9')](_0x5c2d('0xa'),{'failureRedirect':'/login','scope':['profile',_0x5c2d('0xb')],'session':![]});exports[_0x5c2d('0xc')]=passport['authenticate']('google',{'failureRedirect':_0x5c2d('0xd'),'session':![]});passport[_0x5c2d('0xe')](new GoogleStrategy({'clientID':config[_0x5c2d('0xa')]?config[_0x5c2d('0xa')]['clientID']:'id','clientSecret':config[_0x5c2d('0xa')]?config[_0x5c2d('0xa')]['clientSecret']:_0x5c2d('0xf'),'callbackURL':config[_0x5c2d('0xa')]?config[_0x5c2d('0xa')][_0x5c2d('0x10')]:''},function(_0x126492,_0x32a57,_0x759f80,_0x3eed99){var _0xf6f357,_0x4ff86e;return db['Setting'][_0x5c2d('0x11')]({'where':{'id':0x1},'attributes':[_0x5c2d('0x12'),'blockDuration'],'raw':!![]})[_0x5c2d('0x13')](function(_0x312eed){_0xf6f357=_0x312eed;return db[_0x5c2d('0x14')][_0x5c2d('0x15')]({'where':{'email':_[_0x5c2d('0x16')](_0x759f80['emails'],'value'),'role':{'$or':[_0x5c2d('0x17'),'user',_0x5c2d('0x18')]}}});})['then'](function(_0x24efe0){_0x4ff86e=_0x24efe0;if(_0x4ff86e){if(_0x4ff86e[_0x5c2d('0x19')]){return _0x3eed99('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0xf6f357[_0x5c2d('0x1a')]>0x0){if(_0x4ff86e[_0x5c2d('0x1b')]){if(moment(_0x4ff86e[_0x5c2d('0x1c')])['add'](_0xf6f357[_0x5c2d('0x1a')],_0x5c2d('0x1d'))>moment()){return _0x3eed99(_0x5c2d('0x1e'));}else{return utils[_0x5c2d('0x1f')](_0x4ff86e,0x0,![],null)[_0x5c2d('0x13')](function(){return utils[_0x5c2d('0x20')](_0x4ff86e);})['then'](function(){return _0x3eed99(null,_0x4ff86e);});}}else{return utils[_0x5c2d('0x20')](_0x4ff86e)['then'](function(){return _0x3eed99(null,_0x4ff86e);});}}else{return utils[_0x5c2d('0x20')](_0x4ff86e)[_0x5c2d('0x13')](function(){return _0x3eed99(null,_0x4ff86e);});}}return _0x3eed99(_0x5c2d('0x1e'));})[_0x5c2d('0x21')](function(_0x405f58){_0x3eed99(_0x405f58);});}));
\ No newline at end of file
+var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x7a54,0x106));var _0x47a5=function(_0x4ee8ef,_0x5a3412){_0x4ee8ef=_0x4ee8ef-0x0;var _0x3a0a77=_0x7a54[_0x4ee8ef];return _0x3a0a77;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});}));
\ No newline at end of file