PageSourceSearch

https://www.a2a.it/casa/modules/custom/a2a_login/js/callback.js

js a2a.it collected 2026-09-24 12:14:17 UTC 5,187 bytes, 118 lines download raw bytes

1function forofourlogin(identity){
2  console.log(identity);
3}
4jQuery.fn.forofourlogin = forofourlogin;
5document.addEventListener("DOMContentLoaded", () => {
6  console.log('testcallback');
7  jQuery.fn.getCookieAppCallback = function(name){
8    const nameEQ = name + "=";
9    const ca = document.cookie.split(';');
10    for (let i = 0; i < ca.length; i++) {
11      let c = ca[i];
12      while (c.charAt(0)==' ') c = c.substring(1,c.length);
13      if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
14    }
15    return '';
16  };
17  function setCookieSubCrossCall(name,value,days) {
18    let expires = '';
19    if (days) {
20      const date = new Date();
21      date.setTime(date.getTime() + (days*24*60*60*1000));
22      expires = '; expires=' + date.toUTCString();
23    }
24    console.log("setting cookie");
25    console.log(name);
26    console.log(value);
27    document.cookie = name + '=' + (value || '')  + expires + '; domain=.' + 'a2a.it' + '; path=/; SameSite=None; Secure';
28  }
29  jQuery.fn.setCookieSubCrossCall = setCookieSubCrossCall;
30  function generateSharedCookieFromIdentityTwo(identity,supbag){
31    console.log('gencookishare');
32    //set cookie and reload
33    datamock = {
34      "username": identity.custom_attributes.usernameA2a,
35      "authenticated": true,
36      "clienteLibero": identity.custom_attributes.clienteLibero,
37      "codeTipoCliente": identity.custom_attributes.codeTipoCliente,
38      "dataRegistrazione": "1501239126",
39      "dataUltimaLogin": identity.custom_attributes.dataUltimaLogin,
40      "datoFiscale": identity.custom_attributes.datoFiscale,
41      "email": identity.custom_attributes.email,
42      "fidelity": identity.custom_attributes.fidelity,
43      "maggiorTutela": false,
44      "nome": identity.custom_attributes.nome,
45      "cognome": identity.custom_attributes.cognome,
46      "ragioneSociale": identity.custom_attributes.ragioneSociale,
47      "cellulare": identity.custom_attributes.cellulare,
48      "tipoMercato": identity.custom_attributes.tipo_mercato
49    };
50    if(!(datamock["nome"])){
51      datamock["nome"] = identity.custom_attributes.ragioneSociale;
52    }
53    if(!(datamock["cognome"])){
54      datamock["cognome"] = identity.custom_attributes.ragioneSociale;
55    }
56    jQuery.fn.setCookieSubCrossCall('cattr',JSON.stringify(identity.custom_attributes));
57    if(jQuery('.enabledforofour').length > 0){
58      console.log('casedetected');
59      if(typeof globalSr != "undefined" && typeof globalSr!==undefined){
60        console.log(globalSr);
61      } else {
62        console.log('undefined');
63      }
64      jQuery.fn.forofourlogin(globalSr);
65      return;
66    }
67    jQuery.ajax({
68      success: function (data) {
69        if(data.redirectsubscription){
70          if(data.asptcookie){
71            jQuery.fn.setCookieSubCrossCall('asptlce',data.asptcookie);
72          }
73          if(jQuery('.middle-url').length > 0){
74            if(datamock.codeTipoCliente==='1' || datamock.codeTipoCliente==='2' || datamock.codeTipoCliente==='4' || datamock.codeTipoCliente==='5' || datamock.codeTipoCliente==='6' || datamock.codeTipoCliente==='7' || datamock.codeTipoCliente==='8' || datamock.codeTipoCliente==='9'){
75              let actc = jQuery.fn.getCookieAppCallback('vas_start_cookie');
76              if(actc.indexOf('ariapura') > 0 && actc.indexOf('ariapurabsn')<=1){
77                if(window.location.href.indexOf('test')>-1) {
78                  actc = actc.replace('ariapura', 'ariapurabsn');
79                } else {
80                  actc = actc.replace('ariapura', 'ariapurabusiness');
81                }
82                jQuery.fn.setCookieSubCrossCall('vas_start_cookie',actc);
83              }
84            } else if(datamock.codeTipoCliente==='3' || datamock.codeTipoCliente.length <=0){
85              jQuery('.middle-url').text('https://'+jQuery('.middle-url').text().split('/')[2]+'/a2aenergia/s/');
86            } else {
87              let actc = jQuery.fn.getCookieAppCallback('vas_start_cookie');
88              if(actc.indexOf('ariapurabsn')){
89                actc = actc.replace('ariapurabsn','ariapura');
90                jQuery.fn.setCookieSubCrossCall('vas_start_cookie',actc);
91              }
92              jQuery('.middle-url').text(jQuery('.middle-url').text().replace('purificatore','ariapura'));
93            }
94            window.location.href = jQuery('.middle-url').text();
95          } else {
96            window.location.href = data.returnedredirect;
97          }
98        } else {
99          window.parent.postMessage(JSON.stringify(supbag), location.protocol + "//" + location.host + "/");
100        }
101      },
102      error: function (data) {
103        console.log(data);
104        console.log('error at login');
105        console.log(document.cookie);
106      },
107      data: 'data='+JSON.stringify(datamock)+'&offer='+jQuery.fn.getCookieAppCallback('lastoffer')+'&product='+j
107Query.fn.getCookieAppCallback('lastcommodityprod')+'&subscriptioncallback=1',
108      processData: false,
109      type: 'POST',
110      cache: false,
111      url: '/drupal-login-manager/login'
112    });
113  }
114  jQuery.fn.generateSharedCookieFromIdentityTwo = generateSharedCookieFromIdentityTwo;
115  setTimeout(function(){
116    console.log('testcallbacktimeout');
117  },1000);
118});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.