Example #1
0
        static void Main(string[] args)
        {
            string url      = @"http://css.cps.qqt-dev.com/account/logon";
            var    procesor = new LoginProcessor();
            Spider spider   = Spider.Create(
                new QueueDuplicateRemovedScheduler(), procesor);

            ICookieInjector cookieInjector = null;

            spider.Downloader = new HttpClientDownloader()
            {
                CookieInjector = cookieInjector, AllowAutoRedirect = false
            };
            spider.Downloader.AddAfterDownloadCompleteHandler(new SetCookieHandler());
            string  loginJson = JsonConvert.SerializeObject(new { Username = "******", Password = "******" });
            Request request   = new Request(url);

            request.ContentType = "application/json";
            request.Content     = loginJson;
            request.Method      = HttpMethod.Post;

            //request.AddHeader("Cookie", cookie);
            spider.AddRequest(request);
            spider.Run();
        }
Example #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            LoginProcessor processor = new LoginProcessor(
                $"SELECT * FROM AdminAccount WHERE [Email] = '{txtEmail.Text}' AND [_Password] = '{txtPassword.Text}'"
                );

            processor.Accounts();
        }
        public LoginProcessorTests()
        {
            this.authenticationManager = Substitute.For <IAuthenticationManager>();
            this.logService            = Substitute.For <ILogService <CommonLog> >();
            this.fixture = new Fixture();

            this.processor = new LoginProcessor(this.authenticationManager, this.logService);
        }
Example #4
0
        public LoginProcessorTests()
        {
            _email    = "*****@*****.**";
            _password = "******";

            _authenticationService = new Mock <IAuthenticationService>();
            _processor             = new LoginProcessor(_authenticationService.Object);
            _player = new Player("Wktb8xUwmyZCtqUF7qvAGXeWPCt2", "7r78", _email);
        }
Example #5
0
    private IEnumerator ProcessLoginUser(string server, string id, string password)
    {
        G.Logger.Info("ProcessLoginUser");

        var endPoint = LoginProcessor.GetEndPointAddress(server);
        var task     = LoginProcessor.Login(this, endPoint, id, password, null);

        yield return(task.WaitHandle);
    }
        internal void NewLogin()
        {
            Userinfo.EmailAddress = this.EmailBox.Text;
            Userinfo.Password = this.PasswordBox.Text;

            var newLoginAttempt = new LoginProcessor();

            newLoginAttempt.Login(Userinfo.EmailAddress, Userinfo.Password);
        }
Example #7
0
        public TdsConnection(ITdsStream tdsStream, SqlConnectionString dbConnectionOptions)
        {
            _tdsStream = tdsStream;
            TdsPackage = new TdsPackage(_tdsStream);
            var loginProcessor = new LoginProcessor(TdsPackage, dbConnectionOptions);

            StreamParser = new TdsStreamParser(TdsPackage, loginProcessor);
            StreamParser.ParseInput();
            _messageCountAfterLogin = SqlMessages.Count;
        }
Example #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     LoginCheck.AdminManage();
     if (Request.QueryString["act"] == "check")
     {
         LoginProcessor login = new LoginProcessor();
         if (login.LoginState)
         {
             Response.Redirect("Manage/Main.aspx");
         }
         else
         {
             loginResult = login.Value;
         }
     }
 }
Example #9
0
        public void LoginAccount()
        {
            LoginProcessor login = new LoginProcessor();

            var check = login.Account(txtEmail.Text, txtPassword.Text);

            if (check == true)
            {
                MessageBox.Show("Successfully Login, Welcome Admin", "Login successful", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //Hide();
                System.Threading.Thread.Sleep(500);
                Dashboard admin = new Dashboard(login.Name, login.ID);
                admin.ShowDialog();
            }
            else
            {
                MessageBox.Show("Account not found, please try again", "Invalid Account", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Example #10
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            await LoginProcessor.LoadLogin(Login.Text, Password.Password);

            if (LoginProcessor.isTrue)
            {
                await AuthorizationProcessor.LoadAuth();

                Window1 win1 = new Window1();
                win1.Show();
                win1.loggedUser.Text = Login.Text;
                this.Close();
            }
            else
            {
                Wrong_data.Visibility = Visibility.Visible;
            }
            {
            }
        }
Example #11
0
    private IEnumerator ProcessLoginUser(string server, string id, string password)
    {
        G.Logger.Info("ProcessLoginUser");

        IPEndPoint endPoint;

        try
        {
            endPoint = LoginProcessor.GetEndPointAddress(server);
        }
        catch (Exception e)
        {
            UiMessageBox.Show("Server EndPoint Error: " + e);
            yield break;
        }

        SwitchPanel(LoginPanel, LoadingPanel);

        var task = LoginProcessor.Login(this, endPoint, id, password, p => LoadingText.text = p + "...");

        yield return(task.WaitHandle);

        if (task.Status == TaskStatus.RanToCompletion)
        {
            SwitchPanel(LoadingPanel, MainPanel);

            PlayerPrefs.SetString("LoginServer", server);
            PlayerPrefs.SetString("LoginId", id);
            PlayerPrefs.SetString("LoginPassword", password);
        }
        else
        {
            UiMessageBox.Show(task.Exception.Message);
            SwitchPanel(LoadingPanel, LoginPanel);

            PlayerPrefs.DeleteKey("LoginServer");
            PlayerPrefs.DeleteKey("LoginId");
            PlayerPrefs.DeleteKey("LoginPassword");
        }
    }
Example #12
0
        public ActionResult Login(LoginModel model)
        {
            HttpCookie cookie = new HttpCookie("UserInfo");

            if (ModelState.IsValid)
            {
                int UserCredentialId = LoginProcessor.IsClientExists(model.Username, model.Password);
                if (UserCredentialId != 0)//if the user has an account we are going to the Client page
                {
                    cookie["UserID"] = UserCredentialId.ToString();

                    Response.Cookies.Add(cookie);
                    return(RedirectToAction("Index", "Client"));
                }

                else
                {
                    return(RedirectToAction("SignUp", "ClientRegistration"));
                }
            }
            return(View());
        }
Example #13
0
 public LoginController(LoginProcessor login, AgentProcessor agentProcessor)
 {
     _login          = login;
     _agentProcessor = agentProcessor;
 }
Example #14
0
        public ActionResult Login(LoginInfo model)
        {
            //初始化系統參數
            Configer.Init();

            AD             AD           = new AD();
            VA             VA           = new VA();
            LoginProcessor LP           = new LoginProcessor();
            bool           UseCertLogin = false;
            string         LDAPName     = Configer.LDAPName;
            //string VAVerifyURL = WebConfigurationManager.AppSettings["VAVerifyURL"];
            //string ConnStr = Configer.C_DBConnstring;
            Boolean ContinueLogin = true;

            //Log記錄用
            SYSTEMLOG SL = new SYSTEMLOG();

            SL.UId           = model.UserID;
            SL.Controller    = "Account";
            SL.Action        = "Login";
            SL.StartDateTime = DateTime.Now;
            SL.TotalCount    = 1;

            string        MailServer     = Configer.MailServer;
            int           MailServerPort = Configer.MailServerPort;
            string        MailSender     = Configer.MailSender;
            List <string> MailReceiver   = Configer.MailReceiver;

            //string SendResult = string.Empty;

            if (ModelState.IsValid)
            {
                if (LDAPName == "")
                {
                    //缺少系統參數,需記錄錯誤
                    SL.EndDateTime  = DateTime.Now;
                    SL.SuccessCount = 0;
                    SL.FailCount    = 1;
                    SL.Msg          = "登入作業失敗,錯誤訊息:[缺少系統參數LDAPName]";
                    SL.Result       = false;
                    SF.log2DB(SL, MailServer, MailServerPort, MailSender, MailReceiver);
                    ContinueLogin = false;
                }
                if (ContinueLogin)
                {
                    AD.UserName  = model.UserID;
                    AD.Pwd       = model.Pwd;
                    AD.validType = AD.ValidType.Domain;
                    AD.LDAPName  = LDAPName;

                    //VA.SignData = model.SignData;
                    //VA.Plaintext = model.Plaintext;
                    //VA.txnCode = "TxnCode";
                    //VA.VAVerifyURL = VAVerifyURL;
                    //VA.Tolerate = 120;

                    DateTime LoginStartTime = DateTime.Now;
                    SF.logandshowInfo("登入開始@" + LoginStartTime.ToString(Configer.SystemDateTimeFormat), log_Info);
                    bool     LoginResult  = LP.DoLogin(UseCertLogin, AD, VA);
                    DateTime LoginEndTime = DateTime.Now;
                    SF.logandshowInfo("登入結束@" + LoginEndTime.ToString(Configer.SystemDateTimeFormat), log_Info);
                    string LoginSpanTime = OtherProcesser.TimeDiff(LoginStartTime, LoginEndTime, "Milliseconds");
                    SF.logandshowInfo("本次登入共花費@" + LoginSpanTime + "毫秒", log_Info);

                    if (LoginResult == true)
                    {
                        //登入成功,需紀錄
                        SL.EndDateTime  = DateTime.Now;
                        SL.SuccessCount = 1;
                        SL.FailCount    = 0;
                        SL.Msg          = "登入成功";
                        SF.log2DB(SL, MailServer, MailServerPort, MailSender, MailReceiver);
                        Session["UseCertLogin"] = UseCertLogin;
                        //Session["UseCertLogin"] = true;
                        Session["UserID"] = model.UserID;
                        //Session["UserID"] = "TAS191";
                        int UserRole = SF.getUserRole(model.UserID);
                        Session["UserRole"] = UserRole;

                        //主管導向覆核頁面
                        if (UserRole > 3)
                        {
                            return(RedirectToAction("Index", "Review"));
                        }
                        else
                        {
                            //導向檢查頁面
                            return(RedirectToAction("Index", "Process"));
                        }
                    }
                    else
                    {
                        //string a=VA.ResultStr;

                        //登入失敗,需記錄錯誤
                        SL.EndDateTime = DateTime.Now;
                        SL.FailCount   = 1;
                        if (UseCertLogin)
                        {
                            SL.Msg = "登入失敗,錯誤訊息:[AD或VA驗證失敗]";
                        }
                        else
                        {
                            SL.Msg = "登入失敗,錯誤訊息:[AD驗證失敗]";
                        }
                        SL.Result = false;
                        SF.log2DB(SL, MailServer, MailServerPort, MailSender, MailReceiver);
                        TempData["LoginMsg"] = SL.Msg;

                        return(RedirectToAction("Login", "Account"));
                    }
                }
                else
                {
                    TempData["LoginMsg"] = "登入失敗,錯誤訊息:[系統登入參數遺失]";
                    return(RedirectToAction("Login", "Account"));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
Example #15
0
        public ActionResult Login(LoginInfo model)
        {
            //初始化系統參數
            Configer.Init();

            AD AD = new AD();
            VA VA = new VA();
            LoginProcessor LP = new LoginProcessor();
            bool UseCertLogin = false;
            string LDAPName = Configer.LDAPName;
            //string VAVerifyURL = WebConfigurationManager.AppSettings["VAVerifyURL"];
            //string ConnStr = Configer.C_DBConnstring;
            Boolean ContinueLogin = true;

            //Log記錄用
            SYSTEMLOG SL = new SYSTEMLOG();
            SL.UId = model.UserID;
            SL.Controller = "Account";
            SL.Action = "Login";
            SL.StartDateTime = DateTime.Now;
            SL.TotalCount = 1;

            string MailServer = Configer.MailServer;
            int MailServerPort = Configer.MailServerPort;
            string MailSender = Configer.MailSender;
            List<string> MailReceiver = Configer.MailReceiver;
            //string SendResult = string.Empty;

            if (ModelState.IsValid)
            {
                if (LDAPName == "")
                {
                    //缺少系統參數,需記錄錯誤
                    SL.EndDateTime = DateTime.Now;
                    SL.SuccessCount = 0;
                    SL.FailCount = 1;
                    SL.Msg = "登入作業失敗,錯誤訊息:[缺少系統參數LDAPName]";
                    SL.Result = false;
                    SF.log2DB(SL, MailServer, MailServerPort, MailSender, MailReceiver);
                    ContinueLogin = false;
                }
                if (ContinueLogin)
                {
                    AD.UserName = model.UserID;
                    AD.Pwd = model.Pwd;
                    AD.validType = AD.ValidType.Domain;
                    AD.LDAPName = LDAPName;

                    //VA.SignData = model.SignData;
                    //VA.Plaintext = model.Plaintext;
                    //VA.txnCode = "TxnCode";
                    //VA.VAVerifyURL = VAVerifyURL;
                    //VA.Tolerate = 120;

                    DateTime LoginStartTime = DateTime.Now;
                    SF.logandshowInfo("登入開始@" + LoginStartTime.ToString(Configer.SystemDateTimeFormat), log_Info);
                    bool LoginResult = LP.DoLogin(UseCertLogin, AD, VA);
                    DateTime LoginEndTime = DateTime.Now;
                    SF.logandshowInfo("登入結束@" + LoginEndTime.ToString(Configer.SystemDateTimeFormat), log_Info);
                    string LoginSpanTime = OtherProcesser.TimeDiff(LoginStartTime, LoginEndTime, "Milliseconds");
                    SF.logandshowInfo("本次登入共花費@" + LoginSpanTime + "毫秒", log_Info);

                    if (LoginResult == true)
                    {
                        //登入成功,需紀錄
                        SL.EndDateTime = DateTime.Now;
                        SL.SuccessCount = 1;
                        SL.FailCount = 0;
                        SL.Msg = "登入成功";
                        SF.log2DB(SL, MailServer, MailServerPort, MailSender, MailReceiver);
                        Session["UseCertLogin"] = UseCertLogin;
                        //Session["UseCertLogin"] = true;
                        Session["UserID"] = model.UserID;
                        //Session["UserID"] = "TAS191";
                        int UserRole= SF.getUserRole(model.UserID);
                        Session["UserRole"] = UserRole;

                        //主管導向覆核頁面
                        if (UserRole > 3)
                        {
                            return RedirectToAction("Index", "Review");
                        }
                        else
                        {
                            //導向檢查頁面
                            return RedirectToAction("Index", "Process");
                        }
                    }
                    else
                    {
                        //string a=VA.ResultStr;

                        //登入失敗,需記錄錯誤
                        SL.EndDateTime = DateTime.Now;
                        SL.FailCount = 1;
                        if (UseCertLogin)
                        {
                            SL.Msg = "登入失敗,錯誤訊息:[AD或VA驗證失敗]";
                        }
                        else
                        {
                            SL.Msg = "登入失敗,錯誤訊息:[AD驗證失敗]";
                        }
                        SL.Result = false;
                        SF.log2DB(SL, MailServer, MailServerPort, MailSender, MailReceiver);
                        TempData["LoginMsg"] = SL.Msg;

                        return RedirectToAction("Login", "Account");
                    }
                }
                else
                {
                    TempData["LoginMsg"] = "登入失敗,錯誤訊息:[系統登入參數遺失]";
                    return RedirectToAction("Login", "Account");
                }
            }
            else
            {
                return RedirectToAction("Login", "Account");
            }
        }
        private void Btn_Login_Click(object e)
        {
            try
            {
                PasswordBox pwBox = e as PasswordBox;
                string      pwd   = UtilityLoginDetails.GETInstance.DecryptedPassword = pwBox.Password;

                bool validate = ValidateInputFields(pwd);
                if (!validate)
                {
                    return;
                }

                //Register Event for receiving Logon Response
                //  MemoryManager.OnLogonReplyReceived += MemoryManager_OnLogonReplyReceived;
                LoginProcessor oLoginProcessor = new LoginProcessor();

                MemoryManager.InitializeDefaultMemory();

                LogonRequest oLogonRequest = new LogonRequest();


                //initialze socket
                AsynchronousClient.StartClient();

                //initiate receive
                ReceiverController oReceiverController = new ReceiverController();
                oReceiverController.ReceiveMessage();

                //initiate UMS
                UMSController oUMSController = new UMSController();
                oUMSController.ReceiveUMSMessage();

                //if (BcastEquityChkBx)
                //{
                //    //start receiving broadcast
                //    BroadCastProcessor.objBroadcastController = new BroadcastController();
                //    BroadCastProcessor.objBroadcastController.ConnectToBroadCastServer();
                //}

                if (EquitySegChk)
                {
                    //oLogonRequest.Exchange = 1; //1 - Equity, 2- Derv., 3. Curr
                    CreateEQXloginRequest(pwd, ref oLogonRequest);
                    oLoginProcessor.ProcessData(oLogonRequest);
                }


                //if (DerivativeChkBx)
                //{
                //    CreateDERloginRequest(pwd, ref oLogonRequest);
                //    oLoginProcessor.ProcessData(oLogonRequest);
                //}
                //if (CurrencyChkBx)
                //{
                //    CreateCURloginRequest(pwd, ref oLogonRequest);
                //    oLoginProcessor.ProcessData(oLogonRequest);

                //}
            }
            catch (Exception ex)
            {
                ExceptionUtility.LogError(ex);
            }
        }
Example #17
0
 public TdsStreamParser(TdsPackage tdsPackage, LoginProcessor loginProcessor)
 {
     _tdsPackage     = tdsPackage;
     _loginProcessor = loginProcessor;
 }