Пример #1
0
        public static bool processCardInfo()
        {
            string line;

            while (true)
            {
                line = Console.ReadLine();

                if (line == null)
                {
                    continue;
                }

                if (line.Equals("DONE"))
                {
                    return(true);
                }
                else
                {
                    if (line.Length < 29)
                    {
                        Console.WriteLine("Wrong Card input");
                        continue;
                    }

                    CLogIn.validate(line);
                }
            }

            return(false);
        }
Пример #2
0
        static void Main(string[] args)
        {
            const string logDataPath = "..\\..\\..\\CLIENT\\INSPECTOR.txt";

            CLogIn.load(logDataPath);

            while (true)
            {
                string input = Console.ReadLine();
                if (input != null)
                {
                    string[] words = input.Split(' ');

                    string id  = words[0];
                    string pwd = words[1];
                    //Console.WriteLine("id:{0} pwd:{1}", id, pwd);
                    bool test = CLogIn.doLogIn(id, pwd);
                    if (test)
                    {
                        Console.WriteLine("LOGIN SUCCESS");
                        break;
                    }
                    else
                    {
                        Console.WriteLine("LOGIN FAIL");
                    }
                }
            }
            //Console.ReadKey();
        }
Пример #3
0
 static void Main(string[] args)
 {
     CLogIn.load(logDataPath);
     processLogIn();
     while (true)
     {
         if (!CLogIn.getBusId())
         {
             return;
         }
         processCardInfo();
     }
 }
Пример #4
0
        public ActionResult LogIn(CLogIn login)
        {
            login.txtAccount  = Request.Form["txtaccount"];
            login.txtPassword = Request.Form["txtpwd"];
            CMember cm = (new CMember_Factory()).isAuthticated(login.txtAccount, login.txtPassword);

            if (cm != null)
            {
                Session[CDictionary.welcome] = cm;
                CMember member = Session[CDictionary.welcome] as CMember;

                return(RedirectToAction("Home"));
            }
            return(View());
        }
Пример #5
0
        static void Main(string[] args)
        {
            CLogIn.load(logDataPath);
            processLogIn();
            while (true)
            {
                if (!CLogIn.getBusId())
                {
                    break;
                }
                processCardInfo();
            }
            Thread t_handler = new Thread(sendFilesToServer);

            t_handler.IsBackground = true;
            t_handler.Start();
            t_handler.Join();
        }
Пример #6
0
        public static void processLogIn()
        {
            while (true)
            {
                string input = Console.ReadLine();
                if (input != null)
                {
                    string[] words = input.Split(' ');

                    string id  = words[0];
                    string pwd = words[1];

                    if (CLogIn.isCollect(id, pwd))
                    {
                        CLogIn.doLogIn(id);
                        break;
                    }
                    else
                    {
                        Console.WriteLine("LOGIN FAIL");
                    }
                }
            }
        }
Пример #7
0
        public ActionResult LogIn(CLogIn login, FormCollection form)
        {
            //if (!this.IsCaptchaValid(""))
            //{
            //    ViewBag.ErrorMessage = "會不會算數?";
            //    return View("LogIn", login);
            //}

            login.txtAccount  = Request.Form["txtaccount"];
            login.txtPassword = Request.Form["txtpwd"];
            CMember cm          = (new CMember_Factory()).isAuthticated(login.txtAccount, login.txtPassword);
            var     client      = new System.Net.WebClient();
            var     s           = form["g-recaptcha-response"];
            var     googleReply = client.DownloadString(string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", "6Lc0YQwaAAAAADHlm1si34fV_VD70AEuEN-4-A8j", s));
            dynamic Json        = JObject.Parse(googleReply);
            var     isVerify    = Json.success;


            if (cm != null)
            {
                if (isVerify == "false")
                {
                    ViewBag.ErrorMessage = "證明你是人類";
                    return(View("LogIn", login));
                }

                Session[CDictionary.welcome] = cm;
                CMember member = Session[CDictionary.welcome] as CMember;
                return(RedirectToAction("Home"));
            }
            else
            {
                ViewBag.msg = "帳號或密碼錯誤,請重新輸入正確帳號密碼!";
            }
            return(View());
        }