Exemplo n.º 1
0
 private void 退出EToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (server.ExitPassWord == "")
     {
         CloseServer();
     }
     else
     {
         frm_PassWord passwordForm = new frm_PassWord();
         DialogResult result       = passwordForm.ShowDialog();
         if (result == DialogResult.OK)
         {
             if (server.ExitPassWord == PassWord.MD5Encrypt(passwordForm.Password))
             {
                 if (!System.IO.File.Exists(Constant.PassWordFilename))
                 {
                     PassWord.Save(Constant.PassWordFilename, server.ExitPassWord);
                 }
                 CloseServer();
             }
             else
             {
                 MessageBox.Show("密码错误!", "密码错误", MessageBoxButtons.OK, MessageBoxIcon.Stop);
             }
         }
     }
 }
Exemplo n.º 2
0
        protected override void Execute(CodeActivityContext context)
        {
            Int32 _timeout = TimeoutMS.Get(context);

            CallWithTimeout(new Action(() => {
                try
                {
                    string credName = CredentialName.Get(context);
                    IntPtr credPtr  = new IntPtr();
                    WReadCred(credName, CRED_TYPE.GENERIC, CRED_PERSIST.LOCAL_MACHINE, out credPtr);
                    if (credPtr.ToInt32() == 0)
                    {
                        SharedObject.Instance.Output(SharedObject.enOutputType.Error, "凭证不存在");
                        return;
                    }
                    Credential lRawCredential   = (Credential)Marshal.PtrToStructure(credPtr, typeof(Credential));
                    SecureString securePassWord = new SecureString();
                    foreach (char c in lRawCredential.CredentialBlob)
                    {
                        securePassWord.AppendChar(c);
                    }
                    UserName.Set(context, lRawCredential.UserName);
                    PassWord.Set(context, securePassWord);
                }
                catch (Exception e)
                {
                    SharedObject.Instance.Output(SharedObject.enOutputType.Error, "读取凭证执行过程出错", e.Message);
                }
            }), _timeout);
        }
Exemplo n.º 3
0
 public string GetToken(JsonDocument tokenModel)
 {
     if (!tokenModel.RootElement.TryGetProperty("Name", out JsonElement Name) || !tokenModel.RootElement.TryGetProperty("PassWord", out JsonElement PassWord))
     {
         return("token获取失败");
     }
     else
     {
         var name     = Name.GetString();
         var password = PassWord.GetString();
         var model    = projectInfos.FirstOrDefault(o => o.Name == name && o.PassWord == password);
         if (model != null)
         {
             Dictionary <string, string> clims = new Dictionary <string, string>
             {
                 { "ProjectName", name }
             };
             return(_jwt.GetToken(clims));
         }
         else
         {
             return("token获取失败");
         }
     }
 }
Exemplo n.º 4
0
 public LoginPage()
 {
     BindingContext = Services.Service.Instiance().LoginViewModel;
     InitializeComponent();
     //  NavigationPage.SetHasNavigationBar(this, false);
     Phone.Completed += (s, e) => { PassWord.Focus(); };
 }
Exemplo n.º 5
0
 //用户按钮 1
 private void bUser_KeyPress(object sender, KeyPressEventArgs e)
 {   //输入回车后,跳转密码
     if (e.KeyChar == (char)13)
     {
         PassWord.Focus();
     }
 }
Exemplo n.º 6
0
 public ActionResult ChangePassword(PassWord passWord)
 {
     if (Account.User == null)
     {
         return(RedirectToAction("Login"));
     }
     try
     {
         Employee user = db.Get(Account.User.ID);
         if (user == null)
         {
             return(RedirectToAction("Login"));
         }
         if (Account.User.Password.CompareTo(passWord.Password) != 0)
         {
             throw new Exception("Password Is Incorrect");
         }
         Regex regex = new Regex(@"^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$");
         if (!regex.IsMatch(passWord.NewPassword))
         {
             throw new Exception("Password is not sufficiently complex");
         }
         user.Password = passWord.NewPassword;
         db.Update(user);
         Account.User.Password = passWord.NewPassword;
         return(RedirectToAction("UserProfile"));
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("", ex.Message);
     }
     return(View());
 }
 private void PassWord_GotFocus(object sender, RoutedEventArgs e)
 {
     if (PassWord.Password == "Password")
     {
         PassWord.Clear();
     }
 }
Exemplo n.º 8
0
 private void ButReject_Click(object sender, EventArgs e)
 {
     try
     {
         if (RegistName.Text.Trim().Equals(""))
         {
             MessageBox.Show("用户名不能为空!", "提示");
             RegistName.Focus();
         }
         else if (PassWord.Text.Trim().Equals(""))
         {
             MessageBox.Show("密码不能为空!", "提示");
             PassWord.Focus();
         }
         else if (UserName(RegistName.Text.Trim()))
         {
             MessageBox.Show("用户名已经存在!", "提示");
             ClearAll();
         }
         else
         {
             string sqlStr = "insert user_info (userName, userPwd, roles) values('" + RegistName.Text.Trim() + "','" + PassWord.Text.Trim() + "','" + RolesBox.Text.Trim() + "')";
             if (DBconn.PDData(sqlStr))
             {
                 MessageBox.Show("用户" + RegistName.Text.Trim() + "注册成功!");
             }
             this.Close();
         }
     }catch (Exception ex)            {
         DBconn.conn.Close();
         MessageBox.Show(ex.Message);
         ClearAll();
     }
 }
Exemplo n.º 9
0
        public ActionResult Edit(PassWord p)
        {
            DBManager db = new DBManager();

            db.Update(p);

            return(RedirectToAction("Index"));
        }
Exemplo n.º 10
0
        public ActionResult Create(PassWord p)
        {
            DBManager db = new DBManager();

            db.Add(p);

            return(RedirectToAction("Index"));
        }
 public string SetLoginData(string userName, string password)
 {
     UserID.Clear();
     PassWord.Clear();
     UserID.SendKeys(userName);
     PassWord.SendKeys(password);
     return(ClickOnLogin());
 }
Exemplo n.º 12
0
 public void Save()
 {
     UserName.Save();
     PassWord.Save();
     Title.Save();
     ElasticSearch.Save();
     About.Save();
 }
Exemplo n.º 13
0
        public void Update(PassWord p)
        {
            var tempRec = Database.passWordList.Where(x => x.PassWordID == p.PassWordID).Single();

            tempRec.Note          = p.Note;
            tempRec.PassWordKey   = p.PassWordKey;
            tempRec.PassWordValue = p.PassWordValue;
        }
 public LoginPage EnterPassWord(string passwordKey)
 {
     Wait.Until(ExpectedConditions.ElementToBeClickable(By.CssSelector("#password")));
     PassWord.Click();
     PassWord.SendKeys(passwordKey);
     PassWord.SendKeys(Keys.Enter);
     return(new LoginPage(driver));
 }
Exemplo n.º 15
0
        }//Fin de AddClient.

        private void ClearClient(object obj)
        {
            SelectedIndexOfCollection = -1;
            User      = "";
            Name      = "";
            LastName1 = "";
            LastName2 = "";
            PassWord.Clear();
        }//Fin de AddClient.
Exemplo n.º 16
0
        //Login Using Attributes
        public PurchaseOrderPageObjects GACtrackLogin(string strUserName, string strPassword)
        {
            UserName.SendKeys(strUserName);
            PassWord.SendKeys(strPassword);
            LoginButton.Click();
            Console.WriteLine("GACtrack Login completed successfully");

            //Return an Instance of Purchase Order page object
            return(new PurchaseOrderPageObjects());
        }
Exemplo n.º 17
0
        private void Operate_Click(object sender, RoutedEventArgs e)
        {
            PassWord pw     = new PassWord();
            bool?    result = pw.ShowDialog();

            if (result == true)
            {
                idv.SendControlByte();
            }
        }
Exemplo n.º 18
0
 private void btnPasswordPath_Click(object sender, EventArgs e)
 {
     PassPath = selectFile("");
     txtKeystorePassword.Text = PassPath;
     PassWord = decryptPassword();
     if (!string.IsNullOrEmpty(decryptFile.Trim()) || !string.IsNullOrEmpty(PassWord.Trim()))
     {
         searchAlias();
     }
 }
Exemplo n.º 19
0
 /// <summary>
 /// 返回Servers(被控制端)的一个实例
 /// </summary>
 /// <param name="mainPort">主服务端口</param>
 /// <param name="filePort">文件传输端口</param>
 /// <param name="screenPort">屏幕传输端口</param>
 public Servers(int mainPort, int filePort, int screenPort)
 {
     this.mainPort     = mainPort;
     this.screenPort   = screenPort;
     this.filePort     = filePort;
     this.version      = "1.0.0.0";
     this.exitPassWord = PassWord.Read(ICANSEEYOU.Constant.PassWordFilename);
     if (exitPassWord == null)
     {
         exitPassWord = "";
     }
 }
Exemplo n.º 20
0
 public void LoginToApp()
 {
     UserName.SendKeys("Yuva_HM_DEV");
     PassWord.SendKeys("welcome1");
     LoginButton.Click();
     driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30);
     if (ProfileModal.Displayed)
     {
         driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);
         ProfileModalCancelOption.Click();
         driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);
     }
 }
Exemplo n.º 21
0
 internal void LoginSuccessfull()
 {
     // Populating the data from Excel
     ExcelLib.PopulateInCollection(Test.Base.ExcelPath, "Login");
     // Navigating to Login page using value from Excel
     Driver.driver.Navigate().GoToUrl(ExcelLib.ReadData(2, "url"));
     // Sending the username
     Username.SendKeys(ExcelLib.ReadData(2, "Username"));
     // Sending the password
     PassWord.SendKeys(ExcelLib.ReadData(2, "Password"));
     // Clicking on the login button
     loginButton.Click();
 }
Exemplo n.º 22
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="code"></param>
        private void savePassWord(BaseCommunication sender, Code code)
        {
            DoubleCode tempcode = code as DoubleCode;

            if (tempcode != null)
            {
                if (PassWord.Save(Constant.PassWordFilename, tempcode.Body))
                {
                    this.exitPassWord = tempcode.Body;
                    BaseCode ok = new BaseCode();
                    ok.Head = CodeHead.CHANGE_PASSWORD_OK;
                    sender.SendCode(ok);
                }
            }
        }
Exemplo n.º 23
0
        public void EnviarCorreo(Object[] correos, string asunto, string body, Object[] files)
        {
            if (string.IsNullOrEmpty(PassWord.Trim()))
            {
                XtraMessageBox.Show("Configure la cuenta de correo electronico", GLReferences.Properties.Resources.AppName); return;
            }

            mail = new MailMessage();

            for (int i = 0; i < correos.Length; i++)
            {
                mail.To.Add(new MailAddress(correos[i].ToString()));
            }

            mail.From       = new MailAddress(this.From);
            mail.Subject    = asunto;
            mail.Body       = body;
            mail.IsBodyHtml = true;

            for (int j = 0; j < files.Length; j++)
            {
                if (!string.IsNullOrEmpty(files[j].ToString()))
                {
                    Data = new Attachment(files[j].ToString().Trim(), MediaTypeNames.Application.Octet);
                    mail.Attachments.Add(Data);
                }
            }


            SmtpClient client = new SmtpClient(Servidor, Puerto);

            try
            {
                using (mail)
                {
                    client.Credentials = new System.Net.NetworkCredential(From, PassWord);
                    client.EnableSsl   = true;
                    client.Timeout     = 0;
                    client.Timeout.ToString();
                    client.Send(mail);
                }
                XtraMessageBox.Show("Mensaje enviado con Exito..", GLReferences.Properties.Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("Mensaje no enviado", GLReferences.Properties.Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 24
0
        internal void LoginSuccessfull()
        {
            // Populating the data from Excel
            ExcelLib.PopulateInCollection(Base.ExcelPath, "Login");
            // Navigating to Login page using value from Excel
            Driver.driver.Navigate().GoToUrl(ExcelLib.ReadData(3, "url"));

            Driver.driver.Manage().Window.Maximize();

            var rowid = Int32.Parse(KeysResource.LoginAs);

            // Sending the username
            Email.SendKeys(ExcelLib.ReadData(rowid, "Email"));
            // Sending the password
            PassWord.SendKeys(ExcelLib.ReadData(rowid, "Password"));
            // Clicking on the login button
            loginButton.Click();
        }
Exemplo n.º 25
0
 private void SubmitButton_Click(object sender, RoutedEventArgs e)
 {
     if (UserName != null &&
         UserName.Text == Username &&
         PassWord != null &&
         PassWord.Password == Password)
     {
         MainWindow mw1 = new MainWindow();
         mw1.Show();
         this.Close();
     }
     else
     {
         UserName.Clear();
         PassWord.Clear();
         MessageBox.Show("Login Credentials are incorrect!");
     }
 }
Exemplo n.º 26
0
 private void btnDangNhap_Click(object sender, EventArgs e)
 {
     if (UserName.Trim().Length == 0 || PassWord.Trim().Length == 0)
     {
         XtraMessageBox.Show("Bạn chưa nhập UserName hoặc PassWord!\n\n Mời bạn nhập lại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     else if (UserName.Trim().Length != 0 && PassWord.Trim().Length != 0)
     {
         try
         {
             var user = ds.tbl_Login.FirstOrDefault(x => x.UserName == UserName);
             if (user == null)
             {
                 XtraMessageBox.Show("UserName hoặc PassWord không chính xác!\n\n Mời bạn nhập lại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                 return;
             }
             else
             {
                 if (user.PassWord == PassWord)
                 {
                     DialogResult traloi;
                     traloi = XtraMessageBox.Show("Bạn đã đăng nhập thành công!", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                     Save_Data();
                     this.Hide();
                     if (traloi == DialogResult.OK)
                     {
                         Main main = new Main();
                         main.Show();
                     }
                 }
                 else
                 {
                     XtraMessageBox.Show("UserName hoặc PassWord không chính xác!\n\n Mời bạn nhập lại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     return;
                 }
             }
         }
         catch
         {
             XtraMessageBox.Show("Lỗi hệ thống !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemplo n.º 27
0
        internal void LoginSuccessfull()
        {
            // Populating the data from Excel
            ExcelLib.PopulateInCollection(Base.ExcelPath, "LoginPage");

            // Navigating to Login page using value from Excel
            Driver.driver.Navigate().GoToUrl(ExcelLib.ReadData(2, "Url"));

            // Sending the username
            Email.SendKeys(ExcelLib.ReadData(3, "Email"));

            // Sending the password
            PassWord.SendKeys(ExcelLib.ReadData(3, "Password"));

            // Clicking on the login button
            loginButton.Click();

            //Clicking on skip button
            skipButton.Click();

            Thread.Sleep(3000);

            //Verification
            //var expectedResult = "Owner's Dashboard";
            //implementing data driven framework

            //var expectedResult = "";
            //expectedResult = ExcelLib.ReadData(2,"TestData");
            //var actualResult = Driver.driver.FindElement(By.XPath("//*[@id='main-content']/div/h1/div")).Text;

            //Thread.Sleep(2000);
            //if (expectedResult == actualResult)
            //{
            //   Console.WriteLine("Test Pass");
            //    Thread.Sleep(1000);

            //}
            //else
            //{
            //   Console.WriteLine("Test Fail");
            //    Thread.Sleep(1000);
            //}
        }
Exemplo n.º 28
0
        internal void LoginSuccessfull()
        {
            // Populating the data from Excel
            ExcelLib.PopulateInCollection(Base.ExcelPath, "Login");
            // Navigating to Login page using value from Excel
            Driver.driver.Navigate().GoToUrl(ExcelLib.ReadData(2, "url"));

            //Preinitialize local storage to avoid the welcome screem
            IJavaScriptExecutor js = (IJavaScriptExecutor)Driver.driver;

            js.ExecuteScript("window.localStorage.setItem('dashboard_Firsttime','1')");

            // Sending the username
            Email.SendKeys(ExcelLib.ReadData(2, "Email"));
            // Sending the password
            PassWord.SendKeys(ExcelLib.ReadData(2, "Password"));
            // Clicking on the login button
            loginButton.Click();
        }
        internal void LoginSuccessfull(int rowNum)
        {
            // Driver.WaitForElementVisible(Driver.driver,By.XPath("//*[@id='UserName']"),5);

            // Populating the data from Excel
            ExcelLib.PopulateInCollection(Base.ExcelPath, "LoginPage");

            // Navigating to Login page using value from Excel
            Driver.driver.Navigate().GoToUrl(ExcelLib.ReadData(rowNum, "Url"));

            // Sending the username
            Email.SendKeys(ExcelLib.ReadData(rowNum, "Email"));

            // Sending the password
            PassWord.SendKeys(ExcelLib.ReadData(rowNum, "Password"));

            // Clicking on the login button
            loginButton.Click();
        }
Exemplo n.º 30
0
        protected override void Execute(CodeActivityContext context)
        {
            Int32 _timeout = TimeoutMS.Get(context);

            CallWithTimeout(new Action(() => {
                try
                {
                    string credName             = CredentialName.Get(context);
                    string userName             = UserName.Get(context);
                    SecureString credentialName = PassWord.Get(context);
                    IntPtr inP      = Marshal.SecureStringToBSTR(credentialName);
                    string passWord = Marshal.PtrToStringBSTR(inP);
                    WriteCred(credName, userName, passWord, CRED_TYPE.GENERIC, CRED_PERSIST.LOCAL_MACHINE);
                }
                catch (Exception e)
                {
                    SharedObject.Instance.Output(SharedObject.enOutputType.Error, "设置凭证执行过程出错", e.Message);
                }
            }), _timeout);
        }