PageSourceSearch

https://www.portalmaioresemelhores.com.br/public/assets/js/auth/forgot-password.js?v=1.0.0-1790260489

js portalmaioresemelhores.com.br collected 2026-09-24 14:35:00 UTC 2,150 bytes, 60 lines download raw bytes

1/**
2 * Controller: Esqueci minha senha
3 * Portal Maiores & Melhores 2025
4 */
5
6document.addEventListener('DOMContentLoaded', function () {
7    const forgotForm = document.getElementById('forgotPasswordForm');
8    const cpfInput = document.getElementById('cpf');
9    const submitBtn = document.getElementById('forgotSubmitButton');
10    const btnText = document.getElementById('forgotButtonText');
11    const btnSpinner = document.getElementById('forgotButtonSpinner');
12
13    forgotForm.addEventListener('submit', async function (e) {
14        e.preventDefault();
15
16        // UI State: Loading
17        submitBtn.disabled = true;
18        btnText.classList.add('hidden');
19        btnSpinner.classList.remove('hidden');
20
21        try {
22            const formData = new FormData(forgotForm);
23            const data = Object.fromEntries(formData.entries());
24
25            // Normalize CPF: remove non-numeric and leading zeros
26            if (data.cpf) {
27                data.cpf = data.cpf.replace(/\D/g, "").replace(/^0+/, "");
28            }
29
30            const response = await fetch('/api/v1/forgot-password', {
31                method: 'POST',
32                headers: {
33                    'Content-Type': 'application/json',
34                    'Accept': 'application/json'
35                },
36                body: JSON.stringify(data)
37            });
38
39            const result = await response.json();
40
41            if (result.success) {
42                Modal.showSuccess(
43                    'E-mail Enviado!',
44                    result.message || 'Verifique sua caixa de entrada para as instruções.',
45                    'Entendi',
46                    () => { window.location.href = '/login'; }
47                );
48            } else {
49                throw new Error(result.message || 'Erro ao processar solicitação.');
50            }
51
52        } catch (error) {
53            Modal.showError('Ops!', error.message);
54        } finally {
55            submitBtn.disabled = false;
56            btnText.classList.remove('hidden');
57            btnSpinner.classList.add('hidden');
58        }
59    });
60});

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.