PageSourceSearch

https://ixc.nettop.com.br/central_assinante_web/controller/login/login.js

js nettop.com.br collected 2026-09-24 14:36:11 UTC 16,298 bytes, 381 lines download raw bytes

1$.get('/api-module/central-api/get-model-central', (response) => {
2
3    if(response.data.modelCentral === 'N') {
4        const host = window.location.hostname;
5        const protocolo = location.protocol;
6        window.location.href = protocolo + '//' + host + '/central-assinante';
7    }
8})
9login();
10trocarSenha();
11
12var funcoes_login = {
13    validarLogin(user, password) {
14        router.history.current.matched[0].instances.default.loading = true;
15        var manter_conectado = router.history.current.matched[0].instances.default.manter_conectado;
16
17        var hs_web = new HotsiteWeb();
18        hs_web.iniciarSessao(user, password);
19        if (manter_conectado === true) {
20            $.cookie('manter_conectado', 'S');
21        } else {
22            $.cookie('manter_conectado', 'N');
23        }
24    },
25    recuperarSenha(user) {
26        var hs_web = new HotsiteWeb();
27        router.history.current.matched[0].instances.default.loading_senha = true;
28
29        if (user === '') {
30            hs_web.criarToast('5000', 'Erro!', 'Informe o Login!', 'fas fa-exclamation-circle', 'red', 'id_erro', true, '', 'topCenter');
31        } else {
32            hs_web.validaCamposRecuperaSenha(user).then((retorno)=>{
33                if (retorno){
34                    router.history.current.matched[0].instances.default.habilitar_form_primeiro_acesso = true;
35                    router.history.current.matched[0].instances.default.user = user;
36                    hs_web.getRecuperaSenhaTipo().then((tipo)=>{
37                        router.history.current.matched[0].instances.default.recupera_senha_tipo=tipo;
38                        router.history.current.matched[0].instances.default.esqueceu_senha = true;
39                    })
40                }else{
41                    hs_web.criarToast('5000', 'Erro!', 'Login inválido!', 'fas fa-exclamation-circle', 'red', 'id_erro', true, '', 'topCenter');
42                }
43            })
44
45        }
46        router.history.current.matched[0].instances.default.loading_senha = false;
47    },
48    timer(time){
49        return '0'+parseInt(time/60)+':'+(time%60<10?'0':'')+time%60
50    },
51    setTimer(){
52        counter = setInterval(()=>{
53            if(router.history.current.matched[0].instances.default.cooldown>0){
54                router.history.current.matched[0].instances.default.cooldown-=1
55            }else{
56                router.history.current.matched[0].instances.default.cooldown=300;
57                clearInterval(counter)
58            }
59        }, 1000);
60    },
61    voltarParaLogin() {
62        window.location.reload();
63    },
64    cadastrar(nome_pre_cadastro, telefone_pre_cadastro, cpf_cnpj_pre_cadastro, email_pre_cadastro, senha_pre_cadastro, confirmar_senha_pre_cadastro, tipo_login_cadastro, captcha_cad) {
65        var hs_web = new HotsiteWeb();
66
67        array_dados = {
68            nome: nome_pre_cadastro,
69            telefone: telefone_pre_cadastro,
70            cpf_cnpj: cpf_cnpj_pre_cadastro,
71            email: email_pre_cadastro,
72            senha: senha_pre_cadastro,
73            confirmar_senha: confirmar_senha_pre_cadastro,
74            tipo_login_cadastro: tipo_login_cadastro,
75            captcha: captcha_cad,
76            captcha_esperado: window.captcha
77        };
78
79        if(array_dados.nome == ""){
80
81            hs_web.criarToast('5000', 'Erro!', 'Nome é obrigatório', 'fas fa-exclamation-circle', 'red', 'id_erro');
82            return 0;
83        }
84
85        array_dados.telefone = array_dados.telefone .replace(/[\(\)\.\s-]+/g,'');
86
87        if(array_dados.telefone == ""){
88            hs_web.criarToast('5000', 'Erro!', 'Telefone é obrigatório', 'fas fa-exclamation-circle', 'red', 'id_erro');
89            return 0;
90        }
91
92        if (array_dados.telefone.length < 10){
93            hs_web.criarToast('5000', 'Erro!', 'Telefone inválido', 'fas fa-exclamation-circle', 'red', 'id_erro');
94            return 0;
95        }
96
97        array_dados.cpf_cnpj = array_dados.cpf_cnpj.replace(/[\(\)\.\s-/]+/g,'');
98
99        if(array_dados.cpf_cnpj == ""){
100            hs_web.criarToast('5000', 'Erro!', 'CPF/CNPJ é obrigatório', 'fas fa-exclamation-circle', 'red', 'id_erro');
101            return 0;
102        }
103
104        if (array_dados.cpf_cnpj.length != 11 && array_dados.cpf_cnpj.length != 14){
105            hs_web.criarToast('5000', 'Erro!', 'CPF/CNPJ inválido', 'fas fa-exclamation-circle', 'red', 'id_erro');
106            return 0;
107        }
108
109        if(array_dados.email == ""){
110            hs_web.criarToast('5000', 'Erro!', 'E-mail é obrigatório', 'fas fa-exclamation-circle', 'red', 'id_erro');
111            return 0;
112        }
113
114        if(!hs_web.validarEmail(array_dados.email)){
115            hs_web.criarToast('5000', 'Erro!', 'E-mail inválido', 'fas fa-exclamation-circle', 'red', 'id_erro');
116            return 0;
117        }
118
119        if (array_dados.captcha == ""){
120            hs_web.criarToast('5000', 'Erro!', 'Preencha o captcha!', 'fas fa-exclamation-circle', 'red', 'id_erro');
121            return 0;
122        }
123
124        let captchaRequestData = {
125            text: captcha_cad,
126            cacheKey: document.getElementById('captchaKey').value
127        }
128        $.get('/api-module/auth/validate-captcha', captchaRequestData, (response) => {
129            if (response.status === 'error') {
130                hs_web.refreshCaptchaImage('captchaRegisterImage')
131                hs_web.criarToast('5000', 'Erro!', 'Captchas diferentes!', 'fas fa-exclamation-circle', 'red', 'id_erro');
132                document.getElementById('input_captcha').value = '';
133                app.loading = false;
134                return 0;
135            } else if (response.status === 'success') {
136                hs_web.cadastrarNovoCliente(array_dados);
137            }
138        }).fail((response) => {
139            if (response.status === 498) {
140                hs_web.refreshCaptchaImage('captchaRegisterImage')
141                document.getElementById('input_captcha').value = '';
142                hs_web.criarToast('3000', 'Erro!', 'O tempo para o CAPTCHA expirou. Realize a operação novamente.', 'fas fa-exclamation-circle', 'yellow', 'id_erro')
143                app.loading = false
144                return 0;
145            }
146        })
147    },
148
149    resetarSenhaAoLogarPelaPrimeiraVez(cpf_cnpj, tel_email, user){
150        var hotsiteWeb = new HotsiteWeb();
151
152        if (!cpf_cnpj){
153            hotsiteWeb.criarToast('6000', 'Erro!', 'CPF/CNPJ não informado', 'fas fa-exclamation-circle', 'red', 'id_erro', true, '', 'topCenter');
154            hotsiteWeb.resetaCooldown();
155            return 0;
156        }
157
158        let instdefault = router.history.current.matched[0].instances.default;
159
160        hotsiteWeb.validaCamposRecuperaSenha(instdefault.user,cpf_cnpj,tel_email).then((retorno)=>{
161            if(retorno){
162                if (instdefault.recupera_senha_tipo == 'S'){
163                    hotsiteWeb.recuperarSenha(tel_email, cpf_cnpj)
164                }else{
165                    hotsiteWeb.enviarEmailParaResetarSenha({ cpfCnpj:cpf_cnpj, email:tel_email})
166                }
167            }else{
168                hotsiteWeb.criarToast('6000', 'Erro!', 'Os dados informados são inválidos', 'fas fa-exclamation-circle', 'red', 'id_erro', true, '', 'topCenter');
169                hotsiteWeb.resetaCooldown()
170            }
171        })
172    },
173};
174
175function login() {
176    try {
177        $.ajax({
178            url: __SERVER__ + "/view/login/login.vue",
179            type: "GET",
180            data: "",
181            dataType: 'html'
182        }).done(function (resposta) {
183            __ROTAS__.push({
184                path: '/central_assinante_web/login',
185                name: 'login',
186                component: {
187                    template: resposta,
188                    data() {
189                        return {
190                            user: '',
191                            password: '',
192                            url_video: '',
193                            tipo_login: 'E',
194                            permitir_cadastros_usuario: 'N',
195                            logo_base: '',
196                            logo_base_login: '',
197                            label_login:'',
198                            mask: false,
199                            loading: false,
200                            loading_senha: false,
201                            manter_conectado: false,
202                            nome_pre_cadastro: '',
203                            telefone_pre_cadastro: '',
204                            cpf_cnpj_pre_cadastro: '',
205                            email_pre_cadastro: '',
206                            senha_pre_cadastro: '',
207                            confirmar_senha_pre_cadastro: '',
208                            captcha_pre_cadastro: '',
209                            habilitar_form_primeiro_acesso: false,
210                            cpf_cnpj_reset_password: '',
211                            email_reset_password: '',
212                            esqueceu_senha: false,
213                            cooldown:300,
214                            recupera_senha_tipo:'',
215                            email:'',
216                            cpf_cnpj:'',
217                            telefone_celular:''
218                        }
219                    },
220                    mounted: function () {
221                        if ($(window).width() >= 768) {
222                            $('.login-mobile').remove();
223
224                            var videos = [
225                                {nome: 'back-login-1.mp4'},
226                                {nome: 'back-login-2.mp4'},
227                                {nome: 'back-login-3.mp4'}
228                            ];
229
230                            var num_rand = Math.floor((Math.random() * videos.length) + 1);
231                            var url_video = '/central_assinante_web/assets/movie/' + videos[num_rand - 1].nome;
232                            router.history.current.matched[0].instances.default.url_video = url_video;
233                        } else {
234                            $('.login-principal').remove();
235                        }
236
237                        $(document).ready(function () {
238                            validarFundoLogin();
239                        });
240                    },
241                    methods: {
242                        ...funcoes_login,
243                        aplicarMascaraCpfCnpj(event, campo) {
244                            let valor = event.target.value;
245                            valor = valor.replace(/[^a-zA-Z0-9]/g, '').toUpperCase();
246                            const temLetra = /[a-zA-Z]/.test(valor.substring(0, 12));
247                            let valorFormatado = '';
248                            
249                            if (temLetra) {
250                                let parteAlfa = valor.substring(0, 12);
251                                let parteDV = valor.substring(12).replace(/[^0-9]/g, '').substring(0, 2);
252                                valor = parteAlfa + parteDV;
253                                
254                                for (let i = 0; i < valor.length; i++) {
255                                    if (i === 2 || i === 5) valorFormatado += '.';
256                                    if (i === 8) valorFormatado += '/';
257                                    if (i === 12) valorFormatado += '-';
258                                    valorFormatado += valor[i];
259                                }
260                            } else {
261                                if (valor.length <= 11) {
262                                    for (let i = 0; i < valor.length; i++) {
263                                        if (i === 3 || i === 6) valorFormatado += '.';
264                                        if (i === 9) valorFormatado += '-';
265                                        valorFormatado += valor[i];
266                                    }
267                                } else {
268                                    valor = valor.substring(0, 14);
269                                    for (let i = 0; i < valor.length; i++) {
270                                        if (i === 2 || i === 5) valorFormatado += '.';
271                                        if (i === 8) valorFormatado += '/';
272                                        if (i === 12) valorFormatado += '-';
273                                        valorFormatado += valor[i];
274                                    }
275                                }
276                            }
277                            
278                            this[campo] = valorFormatado;
279                            event.target.value = valorFormatado;
280                        }
281                    }
282                }
283            });
284        })
285    } catch (e) {
286        console.log("Error message ->" + e);
287    }
288}
289
290var funcoes_troca_senha = {
291    salvarNovaSenha(password, confirm){
292        var hotsiteWeb = new HotsiteWeb();
293        if (!password){
294            hotsiteWeb.criarToast('5000', 'Erro!', 'Senha é obrigatório', 'fas fa-exclamation-circle', 'red', 'id_erro');
295        }else if(password.length < 8){
296            hotsiteWeb.criarToast('5000', 'Erro!', 'A senha deve conter pelo menos 8 caracteres', 'fas fa-exclamation-circle', 'red', 'id_erro');
297        }else if(!confirm){
298            hotsiteWeb.criarToast('5000', 'Erro!', 'Confirmar senha é obrigatório', 'fas fa-exclamation-circle', 'red', 'id_erro');
299        }else if(password !== confirm){
300            hotsiteWeb.criarToast('5000', 'Erro!', 'As senhas não conferem', 'fas fa-exclamation-circle', 'red', 'id_erro');
301        }else{
302            let hashPassword = localStorage.getItem('trocarSenhaHash');
303            console.log(hashPassword)
304            if (!hashPassword){
305                hotsiteWeb.criarToast('5000', 'Erro!', 'Link inválido', 'fas fa-exclamation-circle', 'red', 'id_erro');
306            }else{
307                hashPassword = JSON.parse(hashPassword);
308                hotsiteWeb.salvarNovaSenha({ password, hashPassword });
309            }
310        }
311    }
312}
313
314function trocarSenha() {
315    try {
316        $.ajax({
317            url: __SERVER__ + "/view/login/trocar_senha.vue",
318            type: "GET",
319            data: "",
320            dataType: 'html'
321        }).done(function (resposta) {
322            __ROTAS__.push({
323                path: '/central_assinante_web/trocarSenha',
324                name: 'trocar_senha',
325                component: {
326                    template: resposta,
327                    data() {
328                        return {
329                            hash_senha: '',
330                            new_password: '',
331                            confirm_password: '',
332                        }
333                    },
334                    methods: funcoes_troca_senha
335                }
336            });
337        })
338    } catch (e) {
339        console.log("Error message ->" + e);
340    }
341}
342
343var videos = [
344    {nome: 'back-login-1.mp4'},
345    {nome: 'back-login-2.mp4'},
346    {nome: 'back-login-3.mp4'}
347];
348
349var num_rand = Math.floor((Math.random() * videos.length) + 1);
350var url_video = '/central_assinante_web/assets/movie/' + videos[num_rand - 1].nome;
351
352$(document).ready(function () {
353    if (router.history.current.name === 'login') {
354        var hs_web = new HotsiteWeb();
355        var refreshCaptcha = hs_web.refreshCaptchaImage
356
357        let captchaRequestData = {
358            length: 7,
359            height: 40,
360            width: 200
361        };
362        let xhttp = new XMLHttpRequest();
363        xhttp.onreadystatechange = function() {
364            if (this.readyState === 4 && this.status === 200) {
365                let img = document.createElement('img')
366                let response = JSON.parse(xhttp.responseText);
367                img.id = 'captchaRegisterImage'
368                img.src = 'data:image/png;base64,' + response.data.captchaImageBase64;
369                img.style.width = captchaRequestData.width
370                img.style.height = captchaRequestData.height
371                img.addEventListener('click', (event) => {
372                    refreshCaptcha(event.srcElement.id)
373                })
374                document.getElementById('rowCaptcha').prepend(img)
375                document.getElementById('captchaKey').value = response.data.cacheKey
376            }
377        };
378        xhttp.open("GET", '/api-module/auth/generate-captcha-image?length=7&height=40&width=200', true);
379        xhttp.send();
380    }
381});

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.