diff --git a/content.js b/content.js index 7b87cec..c6854a4 100644 --- a/content.js +++ b/content.js @@ -931,7 +931,15 @@ Brief honest assessment of this opportunity for my profile` function getSettings() { return new Promise(resolve => { - chrome.storage.sync.get(['apiKey', 'userProfile', 'language'], resolve); + chrome.storage.sync.get(['apiKey', 'userProfile', 'language'], (data) => { + if (data.userProfile && (data.userProfile.includes('hamzaayed@intaleqapp.com') || data.userProfile.includes('hamzaayedflutter@gmail.com'))) { + data.userProfile = data.userProfile + .replace(/hamzaayed@intaleqapp\.com/g, 'hamzaayed@tripz-egypt.com') + .replace(/hamzaayedflutter@gmail\.com/g, 'hamzaayed@tripz-egypt.com'); + chrome.storage.sync.set({ userProfile: data.userProfile }); + } + resolve(data); + }); }); } diff --git a/popup.js b/popup.js index ea8ba5a..e1268e5 100644 --- a/popup.js +++ b/popup.js @@ -39,8 +39,14 @@ function loadSettings() { document.getElementById('api-key-input').value = data.apiKey; setKeyStatus('ok'); } - document.getElementById('profile-textarea').value = - data.userProfile || DEFAULT_PROFILE; + let profile = data.userProfile || DEFAULT_PROFILE; + if (profile.includes('hamzaayed@intaleqapp.com') || profile.includes('hamzaayedflutter@gmail.com')) { + profile = profile + .replace(/hamzaayed@intaleqapp\.com/g, 'hamzaayed@tripz-egypt.com') + .replace(/hamzaayedflutter@gmail\.com/g, 'hamzaayed@tripz-egypt.com'); + chrome.storage.sync.set({ userProfile: profile }); + } + document.getElementById('profile-textarea').value = profile; document.getElementById('lang-select').value = data.language || 'auto'; });