✏️ 正在编辑: reset-password.js
路径:
/srv/systems_dir/yuppiecred-lidernegocios/public/scripts/reset-password.js
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
$('.reset_password').on('click', function () { var login = $('#usuario').val(); var tipo = $('#tipo_acesso').val(); $.ajax({ type: "POST", dataType: "JSON", url: baseUrl + '/auth/get-usuario-reset-password', data: { login: login, tipo: tipo }, beforeSend: function () { $('#loadingDiv').show(); }, success: function (result) { if (result.email) { $("#loadingDiv").hide(); enviarEmailReset(tipo, result.id, result.email) return false; } $("#loadingDiv").hide(); Swal.fire('Atenção!', result.error, 'warning'); }, error: function () { $("#loadingDiv").hide(); Swal.fire('Falha na solicitação', '', 'error') } }) }) function enviarEmailReset(tipo, usuarioId, email) { var mail = email.split('@')[0]; var dominio = email.split('@')[1]; swal.fire({ title: 'Enviar link para resetar senha?', text: 'Um e-mail será enviado para o e-mail ******' + mail.substring(mail.length - 5, mail.length) + '@' + dominio, showDenyButton: true, showCancelButton: true, confirmButtonText: 'Sim', denyButtonText: 'Cancelar', }).then(function (result) { if (result.isConfirmed) { $.ajax({ type: "POST", dataType: "JSON", url: baseUrl + '/auth/enviar-link-reset-password', data: { tipo: tipo, usuarioId: usuarioId, }, beforeSend: function () { $('#loadingDiv').show(); }, success: function (result) { if (result.error) { $("#loadingDiv").hide(); Swal.fire('Falha na solicitação', result.error, 'error') return false; } $("#loadingDiv").hide(); Swal.fire('Sucesso', result.success, 'success'); }, error: function () { $("#loadingDiv").hide(); Swal.fire('Falha na solicitação', '', 'error') } }) return false; } }); } function onSubmit() { $.ajax({ url : baseUrl + '/auth/reset', type : 'POST', data : { 'token' : $('#token').val(), 'tipo_acesso' : $('#tipo').val(), 'senha' : $('#senha').val(), 'confirmar_senha' : $('#confirmar_senha').val() }, beforeSend: function () { $('#messages').html("<p class='info'>Validando dados, aguarde!</p>"); }, success: function(response) { if (response.alert){ $('#messages').html("<p class='alert'>" + response.alert + "</p>"); } if (response.error){ $('#messages').html("<p class='error'>" + response.error + "</p>"); } if (response.success){ $('#messages').html("<p class='success'>" + response.success + " Redirecinando página...</p>"); alert(response.success + " Redirecinando página..."); window.location.replace(baseUrl + "/index"); } }, error: function(request, error) { $('#messages').html("<p class='error'>Erro no processamento!</p>"); console.log(request); console.log(error); return; } }); } function validate(event) { event.preventDefault(); if (!$('#senha').val() || !$('#confirmar_senha').val()) { alert("Preencha os campos de senha!"); return false; } onSubmit(); } function onload() { var element = document.getElementById('submit'); element.onclick = validate; } onload();
💾 保存文件
← 返回文件管理器