1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
17 // *************************************************************************
18 var _0x27a8=['callbackURL','User','map','value','admin','user','Incorrect\x20username\x20and/or\x20password','catch','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','signToken','login','authenticate','google','/login','profile','email','callback','use','clientID','clientSecret'];(function(_0x3e47c2,_0x29b32b){var _0x4be87c=function(_0x3a6876){while(--_0x3a6876){_0x3e47c2['push'](_0x3e47c2['shift']());}};_0x4be87c(++_0x29b32b);}(_0x27a8,0x170));var _0x827a=function(_0x133de2,_0x2ecfc2){_0x133de2=_0x133de2-0x0;var _0x3de2cc=_0x27a8[_0x133de2];return _0x3de2cc;};'use strict';var _=require('lodash');var passport=require('passport');var GoogleStrategy=require(_0x827a('0x0'))[_0x827a('0x1')];var db=require(_0x827a('0x2'))['db'];var config=require(_0x827a('0x3'));var signToken=require(_0x827a('0x4'))[_0x827a('0x5')];exports[_0x827a('0x6')]=passport[_0x827a('0x7')](_0x827a('0x8'),{'failureRedirect':_0x827a('0x9'),'scope':[_0x827a('0xa'),_0x827a('0xb')],'session':![]});exports[_0x827a('0xc')]=passport[_0x827a('0x7')](_0x827a('0x8'),{'failureRedirect':_0x827a('0x9'),'session':![]});passport[_0x827a('0xd')](new GoogleStrategy({'clientID':config[_0x827a('0x8')]?config[_0x827a('0x8')][_0x827a('0xe')]:'id','clientSecret':config[_0x827a('0x8')]?config[_0x827a('0x8')][_0x827a('0xf')]:'secret','callbackURL':config['google']?config[_0x827a('0x8')][_0x827a('0x10')]:''},function(_0x2d04a3,_0x588e28,_0x5d56f2,_0x9c6b92){db[_0x827a('0x11')]['find']({'where':{'email':_[_0x827a('0x12')](_0x5d56f2['emails'],_0x827a('0x13')),'role':{'$or':[_0x827a('0x14'),_0x827a('0x15'),'agent']}}})['then'](function(_0x2b8117){if(_0x2b8117){return _0x9c6b92(null,_0x2b8117);}_0x9c6b92(_0x827a('0x16'));})[_0x827a('0x17')](function(_0x4a3e8a){_0x9c6b92(_0x4a3e8a);});}));