<commit_before>const Cookies            = require('js-cookie');
const moment             = require('moment');
const Client             = require('./client');
const BinarySocket       = require('./socket');
const GTM                = require('../../_common/base/gtm');
const SocketCache        = require('../../_common/base/socket_cache');
const LocalStore         = require('../../_common/storage').LocalStore;
const getElementById     = require('../../_common/common_functions').getElementById;
const getLanguage        = require('../../_common/language').get;
const urlLang            = require('../../_common/language').urlLang;
const isStorageSupported = require('../../_common/storage').isStorageSupported;
const removeCookies      = require('../../_common/storage').removeCookies;
const paramsHash         = require('../../_common/url').paramsHash;
const urlFor             = require('../../_common/url').urlFor;
const getPropertyValue   = require('../../_common/utility').getPropertyValue;

const LoggedInHandler = (() => {
    const onLoad = () => {
        SocketCache.clear();
        parent.window.is_logging_in = 1; // this flag is used in base.js to prevent auto-reloading this page
        let redirect_url;
        const params = paramsHash(window.location.href);
        BinarySocket.send({ authorize: params.token1 }).then((response) => {
            const account_list = getPropertyValue(response, ['authorize', 'account_list']);
            if (isStorageSupported(localStorage) && isStorageSupported(sessionStorage) && account_list) {
                // redirect url
                const preferred_language   = response.authorize.preferred_language.toLowerCase();
                redirect_url = urlFor(sessionStorage.getItem('redirect_url') || '/', null, preferred_language);
                LocalStore.set('preferred_language', preferred_language);
                sessionStorage.removeItem('redirect_url');
                storeClientAccounts(account_list);
            } else {
                Client.doLogout({ logout: 1 });
            }

            // redirect back
            let set_default = true;
            if (redirect_url) {<commit_msg>Revert "fix:resolve promise error with social networks login (#6718)" (#6723)<commit_after>const Cookies            = require('js-cookie');
const moment             = require('moment');
const Client             = require('./client');
const BinarySocket       = require('./socket');
const GTM                = require('../../_common/base/gtm');
const SocketCache        = require('../../_common/base/socket_cache');
const LocalStore         = require('../../_common/storage').LocalStore;
const getElementById     = require('../../_common/common_functions').getElementById;
const getLanguage        = require('../../_common/language').get;
const urlLang            = require('../../_common/language').urlLang;
const isStorageSupported = require('../../_common/storage').isStorageSupported;
const removeCookies      = require('../../_common/storage').removeCookies;
const paramsHash         = require('../../_common/url').paramsHash;
const urlFor             = require('../../_common/url').urlFor;
const urlForLanguage     = require('../../_common/language').urlFor;
const getPropertyValue   = require('../../_common/utility').getPropertyValue;

const LoggedInHandler = (() => {
    const onLoad = () => {
        SocketCache.clear();
        parent.window.is_logging_in = 1; // this flag is used in base.js to prevent auto-reloading this page
        let redirect_url;
        const params = paramsHash(window.location.href);
        BinarySocket.send({ authorize: params.token1 }).then((response) => {
            const account_list = getPropertyValue(response, ['authorize', 'account_list']);
            if (isStorageSupported(localStorage) && isStorageSupported(sessionStorage) && account_list) {
                // redirect url
                const preferred_language   = response.authorize.preferred_language.toLowerCase();
                redirect_url = urlForLanguage(preferred_language, sessionStorage.getItem('redirect_url'));
                LocalStore.set('preferred_language', preferred_language);
                sessionStorage.removeItem('redirect_url');
                storeClientAccounts(account_list);
            } else {
                Client.doLogout({ logout: 1 });
            }

            // redirect back
            let set_default = true;
            if (redirect_url) {
{'fraction_non_alphanumeric': 0.143783542039356, 'fraction_numerical': 0.0031305903398926656, 'mean_word_length': 2.49453125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3936173', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1088, 'n_words': 221}