1 2 3 4BASE_URL = 'https://comentarios.patoshoje.com.br' 5 6const appUsuarios = new Vue({ 7 el: '#app-usuarios', 8 delimiters: ['[[', ']]'], 9 data: { 10 errors: [], 11 usuario: { 12 apelido: "", 13 senha_atual: "", 14 }, 15 load_form: false, 16 mostrar_form_validacao: false, 17 mostrar_form_cadastro: true, 18 login: {}, 19 ph_token: null, 20 mostrar_form_login: true, 21 }, 22 mounted: function () { 23 24 this.getDadosUsuario() 25 26 }, 27 methods: { 28 29 EditarSenha(){ 30 31 axios({ 32 method: 'post', 33 url: `/usuarios/atualizar-senha-atual/`, 34 headers: {'X-CSRFToken': csrftoken}, 35 data: this.usuario 36 37 }).then( response => { 38 39 if(response.data.sucesso){ 40 $("#modalEditarSenha").modal('hide') 41 toastr.success("Senha editada com sucesso!") 42 } 43 44 }) 45 .catch( (error) => { 46 error.response.data.errors.forEach((item, i) => { 47 toastr.error(item[1]) 48 }) 49 }) 50 }, 51 52 getDadosUsuario(){ 53 54 if(!usuarioLogado){ 55 return 56 } 57 this.usuario.uuid = localStorage.getItem("uuid"); 58 const UUID = this.usuario.uuid; 59 axios({ 60 method: 'get', 61 url: `${BASE_URL}/usuarios/dados/${UUID}`, 62 63 }).then( response => { 64 65 if(response.data.sucesso){ 66 this.usuario.apelido = response.data.apelido 67 } 68 69 }) 70 .catch( (error) => { 71 72 }) 73 74 }, 75 76 recuperarCodigoValidacao(){ 77 78 axios({ 79 method: 'post', 80 url: `${BASE_URL}/usuarios/recuperar-codigo/`, 81 headers: {'X-CSRFToken': csrftoken}, 82 83 }).then( response => { 84 $("#modalCadastroUser").modal('show') 85 }) 86 .catch( (error) => { }) 87 88 }, 89 90 atualizarApelido(){ 91 92 axios({ 93 method: 'post', 94 url: `${BASE_URL}/usuarios/atualizar-apelido/`, 95 headers: {'X-CSRFToken': csrftoken}, 96 data: {apelido: this.usuario.apelido} 97 }).then( response => { 98 toastr.success("Apelido editado com sucesso!") 99 100 }) 101 .catch( (error) => { 102 }) 103 104 }, 105 106 enviarCodigoValidacao(){ 107 108 this.load_form_validacao = true 109 const dataUlr = new Date().getTime(); 110 111 const token_validacao = localStorage.getItem("token-validacao"); 112 113 CabecalhoUsuario['X-CSRFToken'] = csrftoken; 114 CabecalhoUsuario['X-TokenValidacao'] = token_validacao; 115 this.usuario.uuid = localStorage.getItem("uuid"); 116 117 axios({ 118 method: 'post', 119 url: `${BASE_URL}/usuarios/validar-codigo/?date=${dataUlr}`, 120 headers: CabecalhoUsuario, 121 data: {codigo: this.usuario.codigo, uuid: this.usuario.uuid} 122 }).then( response => { 123 124 $("#container-cadastro").remove() 125 this.load_form_validacao = false 126 127 localStorage.setItem("token-local", response.data.token_local); 128 129 toastr.success("Pronto, bem vindo(a)!") 130 this.mostrar_form_validacao = false 131 location.reload(); 132 133 }) 134 .catch( (error) => { 135 136 toastr.error(error.response.data.mensagem) 137 this.load_form_codigo = false 138 this.load_form = false 139 140 }) 141 142 }, 143 144 validaTokenRecaptcha(action){ 145 146 this.load_form = true 147 const dataUlr = new Date().getTime(); 148 CabecalhoUsuario['X-CSRFToken'] = csrftoken; 149 150 grecaptcha.ready( () => { 151 152 grecaptcha.execute(TOKEN_RECAPTCHA, {action: action}).then((token) => { 153 154 axios({ 155 method: 'post', 156 url: `${BASE_URL}/usuarios/ph-captcha/?date=${dataUlr}`, 157 headers: CabecalhoUsuario, 158 data: {response:token} 159 }).then( response => { 160 161 if(response.data.sucesso){ 162 this.ph_token = response.data.ph_token 163 this[action]() 164 return 165 } 166 167 toastr.error("Ocorreu algum problema, tente novamente. (Código 1) ") 168 169 }) 170 .catch((error) => { 171 toastr.error("Ocorreu algum problema, tente novamente . (Código 2)") 172 }) 173 174 }) 175 176 }) 177 178 }, 179 180 fecharModalLogin(){ 181 $("#modalLogin").modal('hide') 182 }, 183 184 cadastrar(){ 185 186 this.errors = [] 187 this.usuario.ph_token = this.ph_token 188 const dataUlr = new Date().getTime(); 189 190 CabecalhoUsuario['X-CSRFToken'] = csrftoken; 191 192 axios({ 193 method: 'post', 194 url: `${BASE_URL}/usuarios/cadastrar/?date=${dataUlr}`, 195 headers: CabecalhoUsuario, 196 data: this.usuario 197 }).then( response => { 198 199 this.mostrar_form_validacao = true
200 this.mostrar_form_cadastro = false 201 this.load_form = false 202 this.usuario = {} 203 localStorage.setItem("token-validacao", response.data.token_validacao); 204 205 }) 206 .catch((error) => { 207 208 error.response.data.errors.forEach((item, i) => { 209 toastr.error(item[1]) 210 }) 211 212 this.load_form = false 213 }) 214 215 }, 216 217 loginUser(){ 218 219 this.errors = [] 220 this.login.ph_token = this.ph_token 221 222 CabecalhoUsuario['X-CSRFToken'] = csrftoken; 223 224 axios({ 225 method: 'post', 226 url: `${BASE_URL}/usuarios/login-beta/`, 227 headers: CabecalhoUsuario, 228 data: this.login 229 }).then( response => { 230 231 this.load_form = false 232 let dados = response.data 233 localStorage.setItem("token-validacao", response.data.token_validacao); 234 localStorage.setItem("uuid", response.data.uuid); 235 236 if(dados.nao_existe){ 237 238 this.usuario.celular = this.login.celular; 239 $("#modalLogin").modal('hide') 240 $("#modalCadastroUser").modal('show') 241 return 242 } 243 244 if(dados.sucesso){ 245 this.mostrar_form_login = false 246 this.mostrar_form_validacao = true 247 } 248 249 }) 250 .catch((error) => { 251 this.load_form = false 252 error.response.data.errors.forEach((item, i) => { 253 toastr.error(item[1]) 254 }) 255 256 }) 257 258 }, 259 260 reenviarToken(){ 261 262 this.errors = [] 263 this.login.ph_token = this.ph_token 264 const dataUlr = new Date().getTime(); 265 266 CabecalhoUsuario['X-CSRFToken'] = csrftoken; 267 268 this.login.codigo = null; 269 this.usuario.codigo = null; 270 271 axios({ 272 method: 'post', 273 url: `${BASE_URL}/usuarios/reenviar-token/?date=${dataUlr}`, 274 headers: CabecalhoUsuario, 275 data: this.login 276 }).then( response => { 277 278 this.load_form = false 279 let dados = response.data 280 281 if(dados.sucesso){ 282 localStorage.setItem("token-validacao", response.data.token_validacao); 283 toastr.success("Código enviado com sucesso!") 284 } 285 286 }) 287 .catch((error) => { 288 this.load_form = false 289 error.response.data.errors.forEach((item, i) => { 290 toastr.error(item[1]) 291 }) 292 293 }) 294 295 }, 296 297 298 } 299}) 300 301const celular = document.querySelector(".celular-cadastro") 302 303if(celular != null){ 304 VMasker(celular).maskPattern("(99) 99999-9999") 305} 306 307const celular_login = document.querySelector(".celular-login") 308 309if(celular_login != null){ 310 VMasker(celular_login).maskPattern("(99) 99999-9999") 311} 312 313$(document).on('click', '.fechar-busca', function(){ 314 $('#search-modal').modal('hide'); 315})
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.