示例#1
0
        public IActionResult HandleGet([FromUri] VulnQuery query)
        {
            var ret           = new List <string>();
            var ACCESS_KEY_ID = "AKIA2E0A8F3B244C9986";
            var SECRET_KEY    = "7CE556A3BC234CC1FF9E8A5C324C0BB70AA21B6D";

            var login      = query.Login;
            var password   = query.Password;
            var keeponline = query.Keeponline != null;


            var sql = new SQLiteCommand("SELECT * FROM USER WHERE login = '******' AND PASSWORD = '******'",
                                        DatabaseUtils._con);

            var reader = sql.ExecuteReader();

            if (reader.Read())
            {
                var user = new User(
                    reader["fname"].ToString(),
                    reader["lname"].ToString(),
                    reader["passportnum"].ToString(),
                    reader["address1"].ToString(),
                    reader["address2"].ToString(),
                    reader["zipcode"].ToString());

                var option = new CookieOptions();
                option.MaxAge = TimeSpan.Parse("864000");
                option.Path   = "/";
                Response.Cookies.Append("login", login, option);

                Logger.Info($"User {user} successfully logged in");


                var provider = new DESCryptoServiceProvider();
                provider.GenerateKey();
                provider.GenerateIV();

                var creditinfo = reader["creditinfo"].ToString();
                EncryptString(provider, creditinfo);

                var msg = $"User {user} credit info is {creditinfo}";
                ret.Append(msg);
                Logger.Info(msg);

                return(LocalRedirect("fwd"));
            }

            Logger.Info($"User {login} failed to sign in");
            return(new JsonResult($"User {login} failed to sign in"));
        }
示例#2
0
 public IActionResult HandleFwd([FromUri] VulnQuery query)
 {
     return(new JsonResult("successfully logged in"));
 }