bee44d7b458f447228ebac014e9c005607017815
[motion2.git] / server / api / setting / setting.controller.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
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.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x7502=['mustache','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','destroy','stack','name','send','index','map','Setting','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','params','rawAttributes','includeAll','find','body','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','upperFirst','custom','getLogoLogin','server/files/images/logos','default','default_loginLogo.svg','\x20not\x20found','download','securePassword','addPreferred','../../config/license/util','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x18d392,_0x1ccf63){var _0x12a25d=function(_0x2d3177){while(--_0x2d3177){_0x18d392['push'](_0x18d392['shift']());}};_0x12a25d(++_0x1ccf63);}(_0x7502,0x15b));var _0x2750=function(_0x3a48e6,_0x2586e0){_0x3a48e6=_0x3a48e6-0x0;var _0x2e17be=_0x7502[_0x3a48e6];return _0x2e17be;};'use strict';var pdf=require(_0x2750('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2750('0x1'));var zipdir=require(_0x2750('0x2'));var jsonpatch=require(_0x2750('0x3'));var rp=require(_0x2750('0x4'));var moment=require(_0x2750('0x5'));var BPromise=require(_0x2750('0x6'));var Mustache=require(_0x2750('0x7'));var util=require('util');var path=require(_0x2750('0x8'));var sox=require('sox');var csv=require(_0x2750('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2750('0xa'));var squel=require(_0x2750('0xb'));var crypto=require('crypto');var jsforce=require(_0x2750('0xc'));var deskjs=require(_0x2750('0xd'));var toCsv=require(_0x2750('0x9'));var querystring=require(_0x2750('0xe'));var Papa=require(_0x2750('0xf'));var Redis=require(_0x2750('0x10'));var authService=require(_0x2750('0x11'));var qs=require(_0x2750('0x12'));var as=require(_0x2750('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2750('0x14'))('api');var utils=require(_0x2750('0x15'));var config=require('../../config/environment');var db=require(_0x2750('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x2750('0x17')][_0x2750('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4dfd21,_0x383ecd,_0x3a099d){if(_0x3a099d){var _0x33c52b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33c52b['test'](_0x383ecd)){return _0x4dfd21;}else{throw new db[(_0x2750('0x19'))][(_0x2750('0x1a'))](_0x2750('0x1b'));}}else{return _0x4dfd21;}}function respondWithRpcPromise(_0x5c5984,_0x509ce0,_0x19873f,_0x46efa7){return new BPromise(function(_0x135dfc,_0x27c155){var _0x2ff313=_0x46efa7||client;return _0x2ff313[_0x2750('0x1c')](_0x5c5984,_0x19873f)[_0x2750('0x1d')](function(_0x561d7a){logger[_0x2750('0x1e')](_0x2750('0x1f'),_0x509ce0,_0x2750('0x20'));logger['debug'](_0x2750('0x21'),_0x509ce0,'request\x20sent',JSON['stringify'](_0x561d7a));if(_0x561d7a['error']){if(_0x561d7a[_0x2750('0x22')][_0x2750('0x23')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x509ce0,_0x561d7a['error'][_0x2750('0x24')]);return _0x27c155(_0x561d7a[_0x2750('0x22')]['message']);}logger[_0x2750('0x22')](_0x2750('0x1f'),_0x509ce0,_0x561d7a[_0x2750('0x22')][_0x2750('0x24')]);return _0x135dfc(_0x561d7a['error'][_0x2750('0x24')]);}else{logger[_0x2750('0x1e')](_0x2750('0x1f'),_0x509ce0,_0x2750('0x20'));_0x135dfc(_0x561d7a[_0x2750('0x25')]['message']);}})[_0x2750('0x26')](function(_0x2733f2){logger[_0x2750('0x22')]('Setting,\x20%s,\x20%s',_0x509ce0,_0x2733f2);_0x27c155(_0x2733f2);});});}function respondWithStatusCode(_0x14de5e,_0x32fd7c){_0x32fd7c=_0x32fd7c||0xcc;return function(_0x53e05c){if(_0x53e05c){return _0x14de5e[_0x2750('0x27')](_0x32fd7c);}return _0x14de5e[_0x2750('0x28')](_0x32fd7c)[_0x2750('0x29')]();};}function respondWithResult(_0x40efc1,_0x5a294a){_0x5a294a=_0x5a294a||0xc8;return function(_0x157982){if(_0x157982){return _0x40efc1['status'](_0x5a294a)[_0x2750('0x2a')](_0x157982);}};}function respondWithFilteredResult(_0x1dc78d,_0x410039){return function(_0x12a81d){if(_0x12a81d){var _0xdc0b1f=_0x12a81d[_0x2750('0x2b')],_0x512a4e=_0x410039[_0x2750('0x2c')],_0x4816c4=_0x410039[_0x2750('0x2c')]+_0x410039[_0x2750('0x2d')],_0x43cad8;if(_0x4816c4>=_0xdc0b1f){_0x4816c4=_0xdc0b1f;_0x43cad8=0xc8;}else{_0x43cad8=0xce;}_0x1dc78d['status'](_0x43cad8);return _0x1dc78d[_0x2750('0x2e')]('Content-Range',_0x512a4e+'-'+_0x4816c4+'/'+_0xdc0b1f)['json'](_0x12a81d);}return null;};}function patchUpdates(_0xc99ae1){return function(_0x1e1b36){try{jsonpatch[_0x2750('0x2f')](_0x1e1b36,_0xc99ae1,!![]);}catch(_0x2f359f){return BPromise['reject'](_0x2f359f);}return _0x1e1b36[_0x2750('0x30')]();};}function saveUpdates(_0x204880,_0x30c2c1){return function(_0x21cf7e){if(_0x21cf7e){return _0x21cf7e[_0x2750('0x31')](_0x204880)[_0x2750('0x1d')](function(_0x51a98f){return _0x51a98f;});}return null;};}function removeEntity(_0x47b694,_0x83339a){return function(_0x1fe91b){if(_0x1fe91b){return _0x1fe91b[_0x2750('0x32')]()[_0x2750('0x1d')](function(){_0x47b694[_0x2750('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x570aaf,_0x369329){return function(_0x7f01d1){if(!_0x7f01d1){_0x570aaf[_0x2750('0x27')](0x194);}return _0x7f01d1;};}function handleError(_0x2a2a47,_0x21b89d){_0x21b89d=_0x21b89d||0x1f4;return function(_0x3e2bbd){logger[_0x2750('0x22')](_0x3e2bbd[_0x2750('0x33')]);if(_0x3e2bbd[_0x2750('0x34')]){delete _0x3e2bbd['name'];}_0x2a2a47[_0x2750('0x28')](_0x21b89d)[_0x2750('0x35')](_0x3e2bbd);};}exports[_0x2750('0x36')]=function(_0x3ffa98,_0x41cf59){var _0x126ec7={},_0x589d30={},_0x138c2a={'count':0x0,'rows':[]};var _0x1171a7=_[_0x2750('0x37')](db[_0x2750('0x38')]['rawAttributes'],function(_0x322cd3){return{'name':_0x322cd3[_0x2750('0x39')],'type':_0x322cd3[_0x2750('0x3a')][_0x2750('0x3b')]};});_0x589d30[_0x2750('0x3c')]=_[_0x2750('0x37')](_0x1171a7,_0x2750('0x34'));_0x589d30[_0x2750('0x3d')]=_[_0x2750('0x3e')](_0x3ffa98[_0x2750('0x3d')]);_0x589d30['filters']=_[_0x2750('0x3f')](_0x589d30['model'],_0x589d30[_0x2750('0x3d')]);_0x126ec7[_0x2750('0x40')]=_[_0x2750('0x3f')](_0x589d30['model'],qs[_0x2750('0x41')](_0x3ffa98[_0x2750('0x3d')][_0x2750('0x41')]));_0x126ec7[_0x2750('0x40')]=_0x126ec7['attributes'][_0x2750('0x42')]?_0x126ec7[_0x2750('0x40')]:_0x589d30[_0x2750('0x3c')];if(!_0x3ffa98[_0x2750('0x3d')][_0x2750('0x43')](_0x2750('0x44'))){_0x126ec7[_0x2750('0x2d')]=qs['limit'](_0x3ffa98[_0x2750('0x3d')][_0x2750('0x2d')]);_0x126ec7[_0x2750('0x2c')]=qs[_0x2750('0x2c')](_0x3ffa98['query'][_0x2750('0x2c')]);}_0x126ec7['order']=qs[_0x2750('0x45')](_0x3ffa98[_0x2750('0x3d')][_0x2750('0x45')]);_0x126ec7['where']=qs[_0x2750('0x46')](_[_0x2750('0x47')](_0x3ffa98['query'],_0x589d30['filters']),_0x1171a7);if(_0x3ffa98['query'][_0x2750('0x48')]){_0x126ec7[_0x2750('0x49')]=_[_0x2750('0x4a')](_0x126ec7[_0x2750('0x49')],{'$or':_[_0x2750('0x37')](_0x1171a7,function(_0x4177c3){if(_0x4177c3[_0x2750('0x3a')]!==_0x2750('0x4b')){var _0x1a07e4={};_0x1a07e4[_0x4177c3[_0x2750('0x34')]]={'$like':'%'+_0x3ffa98[_0x2750('0x3d')]['filter']+'%'};return _0x1a07e4;}})});}_0x126ec7=_[_0x2750('0x4a')]({},_0x126ec7,_0x3ffa98[_0x2750('0x4c')]);var _0x17454d={'where':_0x126ec7['where']};return db[_0x2750('0x38')]['count'](_0x17454d)[_0x2750('0x1d')](function(_0x55cd32){_0x138c2a['count']=_0x55cd32;if(_0x3ffa98[_0x2750('0x3d')]['includeAll']){_0x126ec7[_0x2750('0x4d')]=[{'all':!![]}];}return db[_0x2750('0x38')][_0x2750('0x4e')](_0x126ec7);})[_0x2750('0x1d')](function(_0x37edaf){_0x138c2a[_0x2750('0x4f')]=_0x37edaf;return _0x138c2a;})['then'](respondWithFilteredResult(_0x41cf59,_0x126ec7))[_0x2750('0x26')](handleError(_0x41cf59,null));};exports['show']=function(_0x187041,_0x47cd0c){var _0x4da823={'raw':![],'where':{'id':_0x187041[_0x2750('0x50')]['id']}},_0x1afb97={};_0x1afb97[_0x2750('0x3c')]=_[_0x2750('0x3e')](db[_0x2750('0x38')][_0x2750('0x51')]);_0x1afb97[_0x2750('0x3d')]=_[_0x2750('0x3e')](_0x187041['query']);_0x1afb97['filters']=_['intersection'](_0x1afb97[_0x2750('0x3c')],_0x1afb97[_0x2750('0x3d')]);_0x4da823[_0x2750('0x40')]=_['intersection'](_0x1afb97[_0x2750('0x3c')],qs['fields'](_0x187041[_0x2750('0x3d')]['fields']));_0x4da823['attributes']=_0x4da823[_0x2750('0x40')][_0x2750('0x42')]?_0x4da823[_0x2750('0x40')]:_0x1afb97[_0x2750('0x3c')];if(_0x187041[_0x2750('0x3d')][_0x2750('0x52')]){_0x4da823['include']=[{'all':!![]}];}_0x4da823=_[_0x2750('0x4a')]({},_0x4da823,_0x187041['options']);return db[_0x2750('0x38')][_0x2750('0x53')](_0x4da823)[_0x2750('0x1d')](handleEntityNotFound(_0x47cd0c,null))[_0x2750('0x1d')](respondWithResult(_0x47cd0c,null))[_0x2750('0x26')](handleError(_0x47cd0c,null));};exports['update']=function(_0x3b720c,_0x19cee0){if(_0x3b720c[_0x2750('0x54')]['id']){delete _0x3b720c['body']['id'];}return db[_0x2750('0x38')][_0x2750('0x53')]({'where':{'id':_0x3b720c[_0x2750('0x50')]['id']}})['then'](handleEntityNotFound(_0x19cee0,null))[_0x2750('0x1d')](saveUpdates(_0x3b720c[_0x2750('0x54')],null))['then'](respondWithResult(_0x19cee0,null))['catch'](handleError(_0x19cee0,null));};exports['addLogo']=function(_0x3425da,_0x287195,_0x2c79c3){if(_0x3425da[_0x2750('0x55')]&&_0x3425da[_0x2750('0x55')][_0x2750('0x56')]){_0x3425da[_0x2750('0x54')][_0x2750('0x57')]=_0x3425da[_0x2750('0x55')][_0x2750('0x56')];}return db[_0x2750('0x38')]['find']({'where':{'id':_0x3425da[_0x2750('0x50')]['id']}})[_0x2750('0x1d')](handleEntityNotFound(_0x287195,null))['then'](saveUpdates(_0x3425da[_0x2750('0x54')],null))['then'](respondWithResult(_0x287195,null))['catch'](handleError(_0x287195,null));};exports[_0x2750('0x58')]=function(_0x276369,_0x1a3d01,_0x2f6843){if(_0x276369[_0x2750('0x55')]&&_0x276369[_0x2750('0x55')][_0x2750('0x56')]){_0x276369[_0x2750('0x54')][_0x2750('0x59')]=_0x276369['file']['filename'];}return db[_0x2750('0x38')]['find']({'where':{'id':_0x276369[_0x2750('0x50')]['id']}})['then'](handleEntityNotFound(_0x1a3d01,null))[_0x2750('0x1d')](saveUpdates(_0x276369['body'],null))[_0x2750('0x1d')](respondWithResult(_0x1a3d01,null))[_0x2750('0x26')](handleError(_0x1a3d01,null));};var utilLicense=require('../../config/license/util');exports[_0x2750('0x5a')]=function(_0x149434,_0x28c811,_0x3cdf55){var _0x66b341='server/files/images/logos';var _0x2c0853={'custom':![]};return utilLicense[_0x2750('0x5b')]()[_0x2750('0x1d')](function(_0x4daca3){if(_0x4daca3){_0x2c0853=_0x4daca3;}return db[_0x2750('0x38')][_0x2750('0x53')]({'where':{'id':_0x149434['params']['id']},'attributes':[_0x2750('0x57'),_0x2750('0x59'),_0x2750('0x5c'),_0x2750('0x5d'),_0x2750('0x5e'),_0x2750('0x5f'),_0x2750('0x60'),_0x2750('0x61')],'raw':!![]});})[_0x2750('0x1d')](handleEntityNotFound(_0x28c811,null))[_0x2750('0x1d')](function(_0x190727){if(_0x190727){var _0x57d37f=_0x190727[_0x2750('0x57')]&&fs[_0x2750('0x62')](path[_0x2750('0x63')](config['root'],_0x66b341,_[_0x2750('0x64')](_0x190727['logo'])))?path[_0x2750('0x63')](config[_0x2750('0x65')],_0x66b341,_[_0x2750('0x64')](_0x190727[_0x2750('0x57')])):path[_0x2750('0x63')](config[_0x2750('0x65')],_0x66b341,_[_0x2750('0x64')](_0x2750('0x66')));var _0x498086='default'+_[_0x2750('0x67')]('logo');if(_0x190727[_0x498086]||!_0x2c0853[_0x2750('0x68')]){_0x57d37f=path['join'](config[_0x2750('0x65')],_0x66b341,_[_0x2750('0x64')](_0x2750('0x66')));}if(!fs['existsSync'](_0x57d37f)){throw new db[(_0x2750('0x19'))][(_0x2750('0x1a'))](_[_0x2750('0x67')](_0x2750('0x57'))+'\x20not\x20found');}return _0x28c811['download'](_0x57d37f);}})['catch'](handleError(_0x28c811,null));};var utilLicense=require('../../config/license/util');exports[_0x2750('0x69')]=function(_0x92b0f9,_0x526cd3,_0x3dd51b){var _0x10ec01=_0x2750('0x6a');var _0x165c80={'custom':![]};return utilLicense[_0x2750('0x5b')]()[_0x2750('0x1d')](function(_0x2c4eea){if(_0x2c4eea){_0x165c80=_0x2c4eea;}return db['Setting']['find']({'where':{'id':_0x92b0f9[_0x2750('0x50')]['id']},'attributes':[_0x2750('0x57'),_0x2750('0x59'),_0x2750('0x5c'),_0x2750('0x5d'),_0x2750('0x5e'),_0x2750('0x5f'),_0x2750('0x60'),_0x2750('0x61')],'raw':!![]});})[_0x2750('0x1d')](handleEntityNotFound(_0x526cd3,null))[_0x2750('0x1d')](function(_0x463684){if(_0x463684){var _0x2ba3e7=_0x463684[_0x2750('0x59')]&&fs[_0x2750('0x62')](path[_0x2750('0x63')](config[_0x2750('0x65')],_0x10ec01,_['toLower'](_0x463684[_0x2750('0x59')])))?path[_0x2750('0x63')](config['root'],_0x10ec01,_['toLower'](_0x463684[_0x2750('0x59')])):path[_0x2750('0x63')](config[_0x2750('0x65')],_0x10ec01,_[_0x2750('0x64')]('default_loginLogo.svg'));var _0x5d3ca1=_0x2750('0x6b')+_['upperFirst']('loginLogo');if(_0x463684[_0x5d3ca1]||!_0x165c80['custom']){_0x2ba3e7=path[_0x2750('0x63')](config['root'],_0x10ec01,_[_0x2750('0x64')](_0x2750('0x6c')));}if(!fs['existsSync'](_0x2ba3e7)){throw new db[(_0x2750('0x19'))]['ValidationError'](_[_0x2750('0x67')](_0x2750('0x59'))+_0x2750('0x6d'));}return _0x526cd3[_0x2750('0x6e')](_0x2ba3e7);}})[_0x2750('0x26')](handleError(_0x526cd3,null));};exports['gdpr']=function(_0x4f010f,_0x447a15){return db[_0x2750('0x38')][_0x2750('0x53')]({'where':{'id':_0x4f010f[_0x2750('0x50')]['id']},'attributes':[_0x2750('0x6f')]})[_0x2750('0x1d')](respondWithResult(_0x447a15,null))['catch'](handleError(_0x447a15,null));};exports[_0x2750('0x70')]=function(_0x238171,_0x23c2c2,_0x2bed0c){if(_0x238171[_0x2750('0x55')]&&_0x238171[_0x2750('0x55')][_0x2750('0x56')]){_0x238171[_0x2750('0x54')][_0x2750('0x5c')]=_0x238171['file'][_0x2750('0x56')];}return db[_0x2750('0x38')]['find']({'where':{'id':_0x238171[_0x2750('0x50')]['id']}})[_0x2750('0x1d')](handleEntityNotFound(_0x23c2c2,null))[_0x2750('0x1d')](saveUpdates(_0x238171[_0x2750('0x54')],null))[_0x2750('0x1d')](respondWithResult(_0x23c2c2,null))[_0x2750('0x26')](handleError(_0x23c2c2,null));};var utilLicense=require(_0x2750('0x71'));exports['getPreferred']=function(_0x3594a7,_0x249b40,_0x32daa4){var _0x5b7e3a=_0x2750('0x6a');var _0x4e9835={'custom':![]};return utilLicense[_0x2750('0x5b')]()[_0x2750('0x1d')](function(_0x2f68cd){if(_0x2f68cd){_0x4e9835=_0x2f68cd;}return db[_0x2750('0x38')]['find']({'where':{'id':_0x3594a7[_0x2750('0x50')]['id']},'attributes':['logo','loginLogo',_0x2750('0x5c'),_0x2750('0x5d'),_0x2750('0x5e'),_0x2750('0x5f'),_0x2750('0x60'),'defaultFavicon'],'raw':!![]});})[_0x2750('0x1d')](handleEntityNotFound(_0x249b40,null))[_0x2750('0x1d')](function(_0x9cbb87){if(_0x9cbb87){var _0xd3a541=_0x9cbb87[_0x2750('0x5c')]&&fs[_0x2750('0x62')](path[_0x2750('0x63')](config[_0x2750('0x65')],_0x5b7e3a,_[_0x2750('0x64')](_0x9cbb87['preferred'])))?path[_0x2750('0x63')](config[_0x2750('0x65')],_0x5b7e3a,_[_0x2750('0x64')](_0x9cbb87[_0x2750('0x5c')])):path[_0x2750('0x63')](config[_0x2750('0x65')],_0x5b7e3a,_[_0x2750('0x64')](_0x2750('0x72')));var _0x5324c7=_0x2750('0x6b')+_[_0x2750('0x67')](_0x2750('0x5c'));if(_0x9cbb87[_0x5324c7]||!_0x4e9835[_0x2750('0x68')]||!_0x4e9835[_0x2750('0x5c')]){_0xd3a541=path[_0x2750('0x63')](config[_0x2750('0x65')],_0x5b7e3a,_[_0x2750('0x64')](_0x2750('0x72')));}if(!fs['existsSync'](_0xd3a541)){throw new db['Sequelize'][(_0x2750('0x1a'))](_[_0x2750('0x67')](_0x2750('0x5c'))+'\x20not\x20found');}return _0x249b40['download'](_0xd3a541);}})[_0x2750('0x26')](handleError(_0x249b40,null));};exports[_0x2750('0x73')]=function(_0x148852,_0x1508d6,_0x463788){if(_0x148852[_0x2750('0x55')]&&_0x148852[_0x2750('0x55')]['filename']){_0x148852[_0x2750('0x54')]['favicon']=_0x148852[_0x2750('0x55')][_0x2750('0x56')];}return db[_0x2750('0x38')]['find']({'where':{'id':_0x148852[_0x2750('0x50')]['id']}})[_0x2750('0x1d')](handleEntityNotFound(_0x1508d6,null))[_0x2750('0x1d')](saveUpdates(_0x148852[_0x2750('0x54')],null))[_0x2750('0x1d')](respondWithResult(_0x1508d6,null))[_0x2750('0x26')](handleError(_0x1508d6,null));};var utilLicense=require(_0x2750('0x71'));exports[_0x2750('0x74')]=function(_0x2b963d,_0x213232,_0x382539){var _0x3a358e=_0x2750('0x6a');var _0xf65485={'custom':![]};return utilLicense[_0x2750('0x5b')]()[_0x2750('0x1d')](function(_0x389d59){if(_0x389d59){_0xf65485=_0x389d59;}return db[_0x2750('0x38')][_0x2750('0x53')]({'where':{'id':_0x2b963d[_0x2750('0x50')]['id']},'attributes':[_0x2750('0x57'),'loginLogo',_0x2750('0x5c'),'favicon',_0x2750('0x5e'),_0x2750('0x5f'),_0x2750('0x60'),_0x2750('0x61')],'raw':!![]});})[_0x2750('0x1d')](handleEntityNotFound(_0x213232,null))[_0x2750('0x1d')](function(_0x58a6c3){if(_0x58a6c3){var _0x34235b=_0x58a6c3['favicon']&&fs[_0x2750('0x62')](path['join'](config[_0x2750('0x65')],_0x3a358e,_[_0x2750('0x64')](_0x58a6c3[_0x2750('0x5d')])))?path[_0x2750('0x63')](config[_0x2750('0x65')],_0x3a358e,_['toLower'](_0x58a6c3[_0x2750('0x5d')])):path['join'](config[_0x2750('0x65')],_0x3a358e,_[_0x2750('0x64')](_0x2750('0x75')));var _0x5645ce=_0x2750('0x6b')+_['upperFirst']('favicon');if(_0x58a6c3[_0x5645ce]||!_0xf65485[_0x2750('0x68')]){_0x34235b=path[_0x2750('0x63')](config['root'],_0x3a358e,_['toLower'](_0x2750('0x75')));}if(!fs[_0x2750('0x62')](_0x34235b)){throw new db['Sequelize'][(_0x2750('0x1a'))](_[_0x2750('0x67')]('favicon')+_0x2750('0x6d'));}return _0x213232[_0x2750('0x6e')](_0x34235b);}})[_0x2750('0x26')](handleError(_0x213232,null));};