public static void Configure(
     DbContextOptionsBuilder <ABPBlogDbContext> dbContextOptions,
     string connectionString
     )
 {
     /* This is the single point to configure DbContextOptions for ABPBlogDbContext */
     // dbContextOptions.UseSqlServer(connectionString);dbContextOptions
     dbContextOptions.UseMySQL(CompressHelper.AES_Decrypt(connectionString, "qwertyuiop", "1234567891234567"));
 }
Exemple #2
0
        private User GetCurrentUser()
        {
            string str = _httpContextAccessor.HttpContext.Session.GetString("abpblogsession");

            if (!string.IsNullOrWhiteSpace(str))
            {
                str = CompressHelper.AES_Decrypt(str, "qwertyuiop", "1234567891234567");
                return(_userService.GetUserByName(str));
            }
            return(null);
        }
Exemple #3
0
        public string GetCurrentUserName()
        {
            string str = _session.GetString("abpblogsession");

            if (string.IsNullOrWhiteSpace(str))
            {
                return("ljtx");
            }
            str = CompressHelper.AES_Decrypt(str, "qwertyuiop", "1234567891234567");
            return(str);
        }
Exemple #4
0
        public void OnActionExecuting(ActionExecutingContext context)
        {
            var session = context.HttpContext.Session;

            if (session != null)
            {
                var result = session.GetString("abpblogsession");
                if (result != null)
                {
                    var str = CompressHelper.AES_Decrypt(result, "qwertyuiop", "1234567891234567");
                    if (str != "ljtx")
                    {
                        context.Result = new RedirectResult("/Home/Index");
                        return;
                    }
                }
            }
        }