Esempio 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());
        }
Esempio n. 2
0
        public ActionResult DetallesDeOfertasDeDonaciones(string Email, int Id, string descripcion)
        {
            var     Usuario = _context.Usuario.FirstOrDefault(user => user.Id == Id);
            Correos c       = new Correos();

            if (Usuario != null)
            {
                string solicitante = Usuario.Email.ToString();
                string objeto      = descripcion;

                string to      = Email;
                string subject = "Possible petitioner";

                //Mejorar este mensaje y ponerlo con HTML
                string body = "Hello, the user: "******" is interested in taking your request: " + objeto + ", that you posted in our page, please send him an email him with the details to the place were you can deal the donation.";

                c.enviarCorreo(to, subject, body);

                return(RedirectToAction("HomePage", "Home", new { flag = 5, UsuarioId = Usuario.Id, Usuario.Email }));
            }
            else
            {
                //Enviar VB de usuario no registrado
            }
            return(View());
        }