Built motion from commit (unavailable).|2.5.25
[motion2.git] / server / api / authGoogle / authGoogle.controller.js
index 0dfb4bb..5329cd3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5b16=['passport-google-oauth20','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','authenticate','google','/login','profile','callback','use','clientID','secret','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','emails','admin','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','passport'];(function(_0x16139b,_0x47eda6){var _0x2970a8=function(_0x39ef88){while(--_0x39ef88){_0x16139b['push'](_0x16139b['shift']());}};_0x2970a8(++_0x47eda6);}(_0x5b16,0x17f));var _0x65b1=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x5b16[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require('lodash');var passport=require(_0x65b1('0x0'));var GoogleStrategy=require(_0x65b1('0x1'))['Strategy'];var moment=require(_0x65b1('0x2'));var db=require(_0x65b1('0x3'))['db'];var config=require(_0x65b1('0x4'));var signToken=require(_0x65b1('0x5'))[_0x65b1('0x6')];var utils=require('../../config/utils');exports['login']=passport[_0x65b1('0x7')](_0x65b1('0x8'),{'failureRedirect':_0x65b1('0x9'),'scope':[_0x65b1('0xa'),'email'],'session':![]});exports[_0x65b1('0xb')]=passport[_0x65b1('0x7')](_0x65b1('0x8'),{'failureRedirect':_0x65b1('0x9'),'session':![]});passport[_0x65b1('0xc')](new GoogleStrategy({'clientID':config[_0x65b1('0x8')]?config['google'][_0x65b1('0xd')]:'id','clientSecret':config[_0x65b1('0x8')]?config[_0x65b1('0x8')]['clientSecret']:_0x65b1('0xe'),'callbackURL':config[_0x65b1('0x8')]?config[_0x65b1('0x8')]['callbackURL']:''},function(_0xe45132,_0x29fa2e,_0xdd2fa2,_0x28f9cf){var _0x1f03df,_0x137c04;return db[_0x65b1('0xf')][_0x65b1('0x10')]({'where':{'id':0x1},'attributes':[_0x65b1('0x11'),_0x65b1('0x12')],'raw':!![]})[_0x65b1('0x13')](function(_0x59e13a){_0x1f03df=_0x59e13a;return db[_0x65b1('0x14')][_0x65b1('0x15')]({'where':{'email':_[_0x65b1('0x16')](_0xdd2fa2[_0x65b1('0x17')],'value'),'role':{'$or':[_0x65b1('0x18'),'user',_0x65b1('0x19')]}}});})[_0x65b1('0x13')](function(_0x110530){_0x137c04=_0x110530;if(_0x137c04){if(_0x137c04[_0x65b1('0x1a')]){return _0x28f9cf(_0x65b1('0x1b'));}else if(_0x1f03df[_0x65b1('0x12')]>0x0){if(_0x137c04['blocked']){if(moment(_0x137c04['blockedAt'])[_0x65b1('0x1c')](_0x1f03df[_0x65b1('0x12')],_0x65b1('0x1d'))>moment()){return _0x28f9cf(_0x65b1('0x1b'));}else{return utils[_0x65b1('0x1e')](_0x137c04,0x0,![],null)['then'](function(){return utils[_0x65b1('0x1f')](_0x137c04);})[_0x65b1('0x13')](function(){return _0x28f9cf(null,_0x137c04);});}}else{return utils['getLicense'](_0x137c04)[_0x65b1('0x13')](function(){return _0x28f9cf(null,_0x137c04);});}}else{return utils[_0x65b1('0x1f')](_0x137c04)[_0x65b1('0x13')](function(){return _0x28f9cf(null,_0x137c04);});}}return _0x28f9cf('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})['catch'](function(_0xe6323f){_0x28f9cf(_0xe6323f);});}));
\ No newline at end of file
+var _0x30f8=['blocked','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport-google-oauth20','../../config/environment','../../config/utils','login','authenticate','google','/login','email','callback','use','clientID','clientSecret','secret','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','map','emails','agent','disabled'];(function(_0x7f50ea,_0x2a31c2){var _0x56faf1=function(_0x3b5e0b){while(--_0x3b5e0b){_0x7f50ea['push'](_0x7f50ea['shift']());}};_0x56faf1(++_0x2a31c2);}(_0x30f8,0xff));var _0x830f=function(_0x529a76,_0x5b3508){_0x529a76=_0x529a76-0x0;var _0x17570b=_0x30f8[_0x529a76];return _0x17570b;};'use strict';var _=require(_0x830f('0x0'));var passport=require('passport');var GoogleStrategy=require(_0x830f('0x1'))['Strategy'];var moment=require('moment');var db=require('../../mysqldb')['db'];var config=require(_0x830f('0x2'));var signToken=require('../../components/auth/service')['signToken'];var utils=require(_0x830f('0x3'));exports[_0x830f('0x4')]=passport[_0x830f('0x5')](_0x830f('0x6'),{'failureRedirect':_0x830f('0x7'),'scope':['profile',_0x830f('0x8')],'session':![]});exports[_0x830f('0x9')]=passport[_0x830f('0x5')](_0x830f('0x6'),{'failureRedirect':'/login','session':![]});passport[_0x830f('0xa')](new GoogleStrategy({'clientID':config['google']?config[_0x830f('0x6')][_0x830f('0xb')]:'id','clientSecret':config['google']?config[_0x830f('0x6')][_0x830f('0xc')]:_0x830f('0xd'),'callbackURL':config[_0x830f('0x6')]?config['google']['callbackURL']:''},function(_0xd4f292,_0x169c63,_0x3e3e92,_0x1061c9){var _0xb99c60,_0x2f7228;return db[_0x830f('0xe')][_0x830f('0xf')]({'where':{'id':0x1},'attributes':[_0x830f('0x10'),_0x830f('0x11')],'raw':!![]})[_0x830f('0x12')](function(_0xd1a24){_0xb99c60=_0xd1a24;return db[_0x830f('0x13')]['find']({'where':{'email':_[_0x830f('0x14')](_0x3e3e92[_0x830f('0x15')],'value'),'role':{'$or':['admin','user',_0x830f('0x16')]}}});})[_0x830f('0x12')](function(_0x1c62cf){_0x2f7228=_0x1c62cf;if(_0x2f7228){if(_0x2f7228[_0x830f('0x17')]){return _0x1061c9('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0xb99c60[_0x830f('0x11')]>0x0){if(_0x2f7228[_0x830f('0x18')]){if(moment(_0x2f7228['blockedAt'])[_0x830f('0x19')](_0xb99c60[_0x830f('0x11')],_0x830f('0x1a'))>moment()){return _0x1061c9(_0x830f('0x1b'));}else{return utils[_0x830f('0x1c')](_0x2f7228,0x0,![],null)['then'](function(){return utils[_0x830f('0x1d')](_0x2f7228);})['then'](function(){return _0x1061c9(null,_0x2f7228);});}}else{return utils[_0x830f('0x1d')](_0x2f7228)[_0x830f('0x12')](function(){return _0x1061c9(null,_0x2f7228);});}}else{return utils[_0x830f('0x1d')](_0x2f7228)['then'](function(){return _0x1061c9(null,_0x2f7228);});}}return _0x1061c9('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x830f('0x1e')](function(_0xfb9caa){_0x1061c9(_0xfb9caa);});}));
\ No newline at end of file