Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / api / authGoogle / authGoogle.controller.js
index 905ce5c..d705757 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8a2a=['Strategy','../../mysqldb','../../config/environment','../../components/auth/service','signToken','google','profile','email','callback','authenticate','/login','use','clientID','clientSecret','Setting','findOne','blockDuration','then','User','find','map','emails','value','admin','user','blocked','blockedAt','add','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8a2a,0x174));var _0xa8a2=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x8a2a[_0x1762b4];return _0x29beda;};'use strict';var _=require(_0xa8a2('0x0'));var passport=require(_0xa8a2('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0xa8a2('0x2')];var moment=require('moment');var db=require(_0xa8a2('0x3'))['db'];var config=require(_0xa8a2('0x4'));var signToken=require(_0xa8a2('0x5'))[_0xa8a2('0x6')];var utils=require('../../config/utils');exports['login']=passport['authenticate'](_0xa8a2('0x7'),{'failureRedirect':'/login','scope':[_0xa8a2('0x8'),_0xa8a2('0x9')],'session':![]});exports[_0xa8a2('0xa')]=passport[_0xa8a2('0xb')](_0xa8a2('0x7'),{'failureRedirect':_0xa8a2('0xc'),'session':![]});passport[_0xa8a2('0xd')](new GoogleStrategy({'clientID':config[_0xa8a2('0x7')]?config[_0xa8a2('0x7')][_0xa8a2('0xe')]:'id','clientSecret':config[_0xa8a2('0x7')]?config[_0xa8a2('0x7')][_0xa8a2('0xf')]:'secret','callbackURL':config['google']?config[_0xa8a2('0x7')]['callbackURL']:''},function(_0x5b2af6,_0x3c4da9,_0x294b3d,_0x424fa8){var _0x423d42,_0x2d4f87;return db[_0xa8a2('0x10')][_0xa8a2('0x11')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xa8a2('0x12')],'raw':!![]})[_0xa8a2('0x13')](function(_0x15f6e9){_0x423d42=_0x15f6e9;return db[_0xa8a2('0x14')][_0xa8a2('0x15')]({'where':{'email':_[_0xa8a2('0x16')](_0x294b3d[_0xa8a2('0x17')],_0xa8a2('0x18')),'role':{'$or':[_0xa8a2('0x19'),_0xa8a2('0x1a'),'agent']}}});})[_0xa8a2('0x13')](function(_0x42f813){_0x2d4f87=_0x42f813;if(_0x2d4f87){if(_0x2d4f87['disabled']){return _0x424fa8('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x423d42[_0xa8a2('0x12')]>0x0){if(_0x2d4f87[_0xa8a2('0x1b')]){if(moment(_0x2d4f87[_0xa8a2('0x1c')])[_0xa8a2('0x1d')](_0x423d42[_0xa8a2('0x12')],'minutes')>moment()){return _0x424fa8(_0xa8a2('0x1e'));}else{return utils[_0xa8a2('0x1f')](_0x2d4f87,0x0,![],null)[_0xa8a2('0x13')](function(){return utils[_0xa8a2('0x20')](_0x2d4f87);})[_0xa8a2('0x13')](function(){return _0x424fa8(null,_0x2d4f87);});}}else{return utils['getLicense'](_0x2d4f87)[_0xa8a2('0x13')](function(){return _0x424fa8(null,_0x2d4f87);});}}else{return utils['getLicense'](_0x2d4f87)['then'](function(){return _0x424fa8(null,_0x2d4f87);});}}return _0x424fa8(_0xa8a2('0x1e'));})[_0xa8a2('0x21')](function(_0x108835){_0x424fa8(_0x108835);});}));
\ No newline at end of file
+var _0xff77=['use','clientID','clientSecret','callbackURL','findOne','allowedLoginAttempts','then','find','value','admin','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','add','minutes','clearBlockUser','getLicense','passport-google-oauth20','Strategy','../../config/environment','../../components/auth/service','signToken','login','google','email','callback','/login'];(function(_0x355c3b,_0xae147a){var _0xcf072=function(_0x37dea0){while(--_0x37dea0){_0x355c3b['push'](_0x355c3b['shift']());}};_0xcf072(++_0xae147a);}(_0xff77,0x1c6));var _0x7ff7=function(_0xbf806a,_0x138c27){_0xbf806a=_0xbf806a-0x0;var _0x2c8f13=_0xff77[_0xbf806a];return _0x2c8f13;};'use strict';var _=require('lodash');var passport=require('passport');var GoogleStrategy=require(_0x7ff7('0x0'))[_0x7ff7('0x1')];var moment=require('moment');var db=require('../../mysqldb')['db'];var config=require(_0x7ff7('0x2'));var signToken=require(_0x7ff7('0x3'))[_0x7ff7('0x4')];var utils=require('../../config/utils');exports[_0x7ff7('0x5')]=passport['authenticate'](_0x7ff7('0x6'),{'failureRedirect':'/login','scope':['profile',_0x7ff7('0x7')],'session':![]});exports[_0x7ff7('0x8')]=passport['authenticate']('google',{'failureRedirect':_0x7ff7('0x9'),'session':![]});passport[_0x7ff7('0xa')](new GoogleStrategy({'clientID':config[_0x7ff7('0x6')]?config['google'][_0x7ff7('0xb')]:'id','clientSecret':config[_0x7ff7('0x6')]?config[_0x7ff7('0x6')][_0x7ff7('0xc')]:'secret','callbackURL':config['google']?config['google'][_0x7ff7('0xd')]:''},function(_0x117be2,_0x2e79b0,_0x360439,_0x1b120e){var _0x57ed11,_0x24fbda;return db['Setting'][_0x7ff7('0xe')]({'where':{'id':0x1},'attributes':[_0x7ff7('0xf'),'blockDuration'],'raw':!![]})[_0x7ff7('0x10')](function(_0x53f307){_0x57ed11=_0x53f307;return db['User'][_0x7ff7('0x11')]({'where':{'email':_['map'](_0x360439['emails'],_0x7ff7('0x12')),'role':{'$or':[_0x7ff7('0x13'),'user',_0x7ff7('0x14')]}}});})[_0x7ff7('0x10')](function(_0x557cba){_0x24fbda=_0x557cba;if(_0x24fbda){if(_0x24fbda[_0x7ff7('0x15')]){return _0x1b120e(_0x7ff7('0x16'));}else if(_0x57ed11[_0x7ff7('0x17')]>0x0){if(_0x24fbda[_0x7ff7('0x18')]){if(moment(_0x24fbda['blockedAt'])[_0x7ff7('0x19')](_0x57ed11[_0x7ff7('0x17')],_0x7ff7('0x1a'))>moment()){return _0x1b120e(_0x7ff7('0x16'));}else{return utils[_0x7ff7('0x1b')](_0x24fbda,0x0,![],null)['then'](function(){return utils[_0x7ff7('0x1c')](_0x24fbda);})['then'](function(){return _0x1b120e(null,_0x24fbda);});}}else{return utils[_0x7ff7('0x1c')](_0x24fbda)[_0x7ff7('0x10')](function(){return _0x1b120e(null,_0x24fbda);});}}else{return utils[_0x7ff7('0x1c')](_0x24fbda)[_0x7ff7('0x10')](function(){return _0x1b120e(null,_0x24fbda);});}}return _0x1b120e(_0x7ff7('0x16'));})['catch'](function(_0x58e940){_0x1b120e(_0x58e940);});}));
\ No newline at end of file