Ejemplo n.º 1
0
        private Login GetDecriptedInformationForAdmin()
        {
            var   admin  = GetByID(1);
            Login result = new Login();

            result.Email    = _encript.DencryptData(admin.Email.ToString());
            result.Password = _encript.DencryptData(admin.Password.ToString());
            return(result);
        }
Ejemplo n.º 2
0
        public IActionResult Index()
        {
            LoginVM login = new LoginVM();

            try
            {
                if (Request.Cookies["UserEmail"] != null ||
                    Request.Cookies["UserEmail"] != "")
                {
                    login.Email    = _encript.DencryptData(Request.Cookies["UserEmail"]);
                    login.Password = _encript.DencryptData(Request.Cookies["Userpassword"]);
                }
            }
            catch (ArgumentNullException ex)
            {
                return(View(login));
            }

            return(View(login));
        }
Ejemplo n.º 3
0
 public EmailServises(Login user)
 {
     _encript         = new EncriptServises();
     _admin           = GetDecriptedInformationForAdmin();
     _userEmail       = _encript.DencryptData(user.Email);
     _userID          = user.ID;
     _smtpClient      = new SmtpClient();
     _basicCredential =
         new NetworkCredential(_admin.Email, _admin.Password);
     _message     = new MailMessage();
     _fromAddress = new MailAddress(_admin.Email);
 }
Ejemplo n.º 4
0
        public ActionResult Index()
        {
            LoginVM login = new LoginVM();

            try
            {
                HttpCookie cookie = HttpContext.Request.Cookies["UserInformation"];
                if (cookie != null ||
                    cookie["UserEmail"] != "")
                {
                    login.Email    = _encript.DencryptData(cookie["UserEmail"]);
                    login.Password = _encript.DencryptData(cookie["Userpassword"]);
                }
            }
            catch (ArgumentNullException ex)
            {
                return(View(login));
            }

            return(View(login));
        }
        public override Contact PopulateIndexContactInfo(Contact model)
        {
            Contact entity = new Contact();

            entity.ID      = model.ID;
            entity.Email   = _encript.DencryptData(model.Email);
            entity.Name    = _encript.DencryptData(model.Name);
            entity.Message = _encript.DencryptData(model.Message);
            entity.Date    = model.Date;
            return(entity);
        }
        public override void OnActionExecuting(ActionExecutingContext context)


        {
            if (context.HttpContext.Session.GetString("LoggedUser") == null)
            {
                context.HttpContext.Response.Redirect("../Error/Login");
            }
            else
            {
                string id = _encript.DencryptData(context.HttpContext.Session.GetString("LoggedUser"));
                if (id != "1")
                {
                    context.HttpContext.Response.Redirect("../Home/Index");
                }
            }
            base.OnActionExecuting(context);
        }