Ejemplo n.º 1
0
        public ActionResult RecuperarContraseña(string Email)
        {
            Encriptacion e       = new Encriptacion();
            Correos      c       = new Correos();
            var          Usuario = _context.Usuario.FirstOrDefault(user => user.Email == Email);

            if (Usuario != null)
            {
                string strToken = Usuario.Email.ToString();
                //ACÁ SE DEBERÍA ENCRIPTAR EL EMAIL
                string claveCompartida = "limoncitoconron";
                string strEncrypted    = e.EncryptStringAES(strToken, claveCompartida);

                var address = "http://freecycle-001-site1.btempurl.com/Usuarios/CambiarContraseña/?tkn=" + strEncrypted;

                string to      = Email;
                string subject = "Password recovery";

                //Mejorar este mensaje y ponerlo con HTML
                string body = "Hello, in the following link you will be able to change your password to recover your account: " + address;

                c.enviarCorreo(to, subject, body);

                //No es necesario se puede manejar con una flag tipica
                ViewBag.Email = Email;
            }
            else
            {
                //Enviar VB de usuario no registrado
            }
            return(View());
        }