Пример #1
0
        private void LoginButton_Click(object sender, EventArgs e)
        {
            username  = textBox1.Text;
            password  = textBox2.Text;
            loginMode = true;
            Hide();

            using (LoginChecker form2 = new LoginChecker())
            {
                form2.ShowDialog();
            }
            loginMode = false;

            if (successtoken)
            {
                using (Form3 form2 = new Form3())
                {
                    form2.ShowDialog();
                }
                Show();
            }
            else
            {
                Show();
            }
        }
Пример #2
0
 public LoginChecker GetLoginChecker()
 {
     if (loginChecker == null)
     {
         loginChecker = new LoginChecker();
     }
     return(loginChecker);
 }
Пример #3
0
        private void InfoValidator()
        {
            ValidResponse = true;
            if (string.IsNullOrEmpty(UIDBox.Text) || string.IsNullOrEmpty(UIDBox.Text) || string.IsNullOrEmpty(PassBox.Text) || string.IsNullOrEmpty(EmailBox.Text))
            {
                MessageBox.Show("Please enter all fields");
                ValidResponse = false;
            }
            else
            {
                try
                {
                    MailAddress m = new MailAddress(EmailBox.Text);
                }
                catch (FormatException)
                {
                    MessageBox.Show("Please enter a valid email");
                    ValidResponse = false;
                }
            }


            UserNameCheck();
            if (UniqueName == false)
            {
                MessageBox.Show("Username already exist");
                label6.Text = "Username already exists.";
            }
            if (ValidResponse && UniqueName)
            {
                name     = UIDBox.Text;
                password = PassBox.Text;
                email    = EmailBox.Text;
                userid   = UIDBox.Text;


                Hide();
                using (TermsAndConditionscs form2 = new TermsAndConditionscs())
                {
                    form2.ShowDialog();
                }
                if (registerMode)
                {
                    ReturnToHomeScreen = true;
                    using (LoginChecker formx = new LoginChecker())
                    {
                        formx.ShowDialog();
                    }
                }
                else
                {
                    MessageBox.Show("You must accept to the terms and conduct, before you register");
                }
                Show();
            }
        }
Пример #4
0
        public async Task <IActionResult> Logout()
        {
            Response.Cookies.Delete("__ZSB_login_sessionKey__");
            var response = await Rest.RestHelper.DoPostDynamic(Startup.LoginServerAddress + "logout",
                                                               new { SessionKey = Request.Cookies["__ZSB_login_sessionKey__"].FirstOrDefault() });

            LoginChecker.MarkInvalid(Request.Cookies["__ZSB_login_sessionKey__"].FirstOrDefault());
            ViewBag.IsLoggingOut = true;
            ViewBag.RedirectTo   = "/";
            return(View("~/Views/RedirectPage"));
        }
        public RePrintNote(IMainFrm mainFrm, User user, TicketPrinter printer)
        {
            InitializeComponent();

            this.mainFrm = mainFrm;
            this._user   = user;
            this.printer = printer;

            strURL = string.Format("{0}/IotM/SFXT/Payment.html", LoginChecker.getInstance().CompanyAccount.ServiceURL);
            this.webKitBrowser1.Url = new System.Uri(strURL, System.UriKind.Absolute);
        }
Пример #6
0
        public PrintTicket(TicketPrinter printer, ChongZhiData chongzhiData, bool isPrev)
        {
            InitializeComponent();
            this.isPrev       = isPrev;
            id                = chongzhiData.AID;
            this.chongzhiData = chongzhiData;
            ticketPrinter     = printer;
            isRePrint         = Convert.ToBoolean(chongzhiData.IsPrint);

            strURL = string.Format("{0}/IotM/SFXT/Payment.html", LoginChecker.getInstance().CompanyAccount.ServiceURL);
            this.webKitBrowser1.Url = new System.Uri(strURL, System.UriKind.Absolute);
        }
Пример #7
0
        public PrintTicket(TicketPrinter printer, PayResult result, User user, bool isPrev)
        {
            InitializeComponent();
            this.pay      = result;
            this.user     = user;
            this.isPrev   = isPrev;
            ticketPrinter = printer;
            id            = result.ID;

            strURL = string.Format("{0}/IotM/SFXT/Payment.html", LoginChecker.getInstance().CompanyAccount.ServiceURL);
            this.webKitBrowser1.Url = new System.Uri(strURL, System.UriKind.Absolute);
        }
Пример #8
0
        /// <summary>
        /// Constructor for the main screen
        /// </summary>
        public MainScreen()
        {
            InitializeComponent();

            m_ctcController.Subscribe(trackDisplayPanel.UpdateDisplay);
            m_ctcController.Subscribe(infoPanel.UpdateDisplay);

            #if !DEBUG
            m_login = new LoginChecker();
            m_login.ShowLogin(OnLoginSuccessful, OnExitClicked);
            #endif

            m_simulatorWindow.Show();
        }
 public Payment(IMainFrm mainFrm, User user)
 {
     InitializeComponent();
     this._user   = user;
     this.mainFrm = mainFrm;
     if (this._user != null)
     {
         this.txtUserId.Text   = this._user.UserID;
         this.txtUserName.Text = this._user.UserName;
         this.txtMeterNo.Text  = this._user.MeterNo;
         this.txtAddress.Text  = this._user.Address;
     }
     this.txtAmount.Select(0, 1);
     strURL = string.Format("{0}/IotM/SFXT/Payment.html", LoginChecker.getInstance().CompanyAccount.ServiceURL);
     this.webKitBrowser1.Url = new System.Uri(strURL, System.UriKind.Absolute);
 }
Пример #10
0
        private void Login_Click(object sender, EventArgs e)
        {
            string UserName = UserNameBox.Text;
            string password = PasswordBox.Text;

            if (UserName == null || UserName.Equals(""))
            {
                MessageBox.Show("Must enter your credentials!");
            }
            else if (LoginChecker.CheckIfValid(UserName, password, ref student)) //Validate the login
            {
                LoggedIn = true;
                Console.WriteLine("user is: " + UserName + "\n" + " pass is: " + password);
                WelcomeUser.Text = "Welcome to the Nation, " + UserName + "!";
                UserNameBox.Clear();
                PasswordBox.Clear();
            }
            else
            {
                MessageBox.Show("Invalid Login!");
            }
        }
Пример #11
0
        public void Can_handle_unsuccessful_login()
        {
            MockRepository        mocks            = new MockRepository();
            ISystemUserRepository repository       = mocks.CreateMock <ISystemUserRepository>();
            IEncryptionEngine     encryptionEngine = mocks.CreateMock <IEncryptionEngine>();

            using (mocks.Record())
            {
                Expect.Call(encryptionEngine.Encrypt("pass")).Return("encryptedPass");
                Expect.Call(repository.IsValidLogin("*****@*****.**", "encryptedPass")).Return(false);
            }

            using (mocks.Playback())
            {
                ILoginChecker loginChecker = new LoginChecker(encryptionEngine);
                bool          isValid      = loginChecker.IsValidUser("*****@*****.**", "pass", repository);

                Assert.That(isValid, Is.False);
            }

            mocks.VerifyAll();
        }
        public PayManageForm(IMainFrm mainFrm)
        {
            InitializeComponent();
            this.mainFrm = mainFrm;
            this.btnPrinterSelect.Visible = mainFrm.IsExist(1024);

            if (LoginChecker.getInstance().Login(mainFrm))
            {
                //登录成功
                string strURL = string.Format("{0}/IotM/SFXT/Payment.html", LoginChecker.getInstance().CompanyAccount.ServiceURL);
                Uri    url    = new System.Uri(strURL, System.UriKind.Absolute);
                this.webKitBrowser1.Url = url;
            }
            else
            {
                this.webKitBrowser1.Url = new System.Uri(string.Format("{0}/{1}", LoginChecker.getInstance().CompanyAccount.ServiceURL,
                                                                       "Fail.html"), System.UriKind.Absolute);;
            }
            //需要增加票据模版定义功能
            using (CompanyAccountServiceBF bf = new CompanyAccountServiceBF())
            {
                this.printer = new TicketPrinter(bf.ICompanyAccount.GetIotPayTicketTemplate());
            }
        }