示例#1
0
        private async void Confirm_bt_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(Senha_txt.Password) || string.IsNullOrEmpty(ConfirmarSenha_txt.Password))
            {
                MessageBox.Show("Preencha ambos os campos!", "Hmmm", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            if (Senha_txt.Password == ConfirmarSenha_txt.Password)
            {
                RecuperarSenha   re  = new RecuperarSenha();
                ExecutarComandos exe = new ExecutarComandos();
                if (await re.Codigo("http://" + PegarInfos.Url + "/renovarsenha.php?cod=" + codigo + "&email=" + email + "&newpwd=" +
                                    exe.CriptografarSenha_SHA256(exe.CriptografarSenha_MD5(Senha_txt.Password))))
                {
                    MessageBox.Show("Senha alterada com Sucesso!", "", MessageBoxButton.OK, MessageBoxImage.Information);
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("As senhas nao coincidem!", "Opps!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
            //codigo = string.Empty;
            //email = string.Empty;
        }
        private async void EnviarEmail_bt_Click(object sender, RoutedEventArgs e)
        {
            RecuperarSenha recover = new RecuperarSenha();

            UInt16 codigo = recover.CodigoRecuperacao();

            if (await recover.Codigo("http://" + PegarInfos.Url + "/armazenarcodigo.php?cod=" + codigo + "&email=" + EmailUsuario_txt.Text))
            {
                recover.EnviarEmail(EmailUsuario_txt.Text, codigo.ToString());
                EmailUsuario_txt.IsReadOnly = true;
            }
        }
        private async void ConfirmarCodigo_bt_Click(object sender, RoutedEventArgs e)
        {
            RecuperarSenha rec = new RecuperarSenha();

            if (await rec.Codigo("http://" + PegarInfos.Url + "/validarcodigo.php?cod=" + CodigoDigitado_txt.Text + "&email=" + EmailUsuario_txt.Text))
            {
                NovaSenha ns = new NovaSenha();
                NovaSenha.codigo = CodigoDigitado_txt.Text;
                NovaSenha.email  = EmailUsuario_txt.Text;
                ns.ShowDialog();
            }

            //limpando codigo que foi digitado
            CodigoDigitado_txt.Clear();
        }