public AbstractGroup GetPasswordActionsWithSamePassword(string password) { List <PasswordAction> passwordActions = PasswordActions. Where(passAct => passAct.ValidPassword == password).ToList(); AbstractGroup group = new PasswordActionGroupLeaf(passwordActions); return(group); }
public List <PasswordAction> GetPasswordActionsByUser() { List <PasswordAction> passwordActions = PasswordActions. Where(passAct => passAct.UserId == this.Settings.User.Id).ToList(); AbstractGroup group = new PasswordActionGroupLeaf(passwordActions); //добавить другие группы паролей return(group); }
public void CreateShipperTest() { ShipperDAL dal = new ShipperDAL(ConfigurationManager.ConnectionStrings["Shipper"].ConnectionString); PasswordActions password = new PasswordActions(); var result = new ShipperDTO { Login = "******", Password = password.PasswordEncryption("1234"), EMail = "Test", Addres = "Test", Phone = "Test", Description = "Test" }; result = dal.CreateShipper(result); Assert.IsTrue(result.ShipperID >= 0, "returned ID should be more than zero"); }
/// <summary> /// Creates the register form with all the components /// This section also adds the register button and its functionality /// </summary> private void CreateTheRegisterForm() { Form form = new Form() { Width = 300, Height = 350, BackColor = Color.WhiteSmoke, StartPosition = FormStartPosition.CenterScreen }; Label mainText = new Label() { Left = 105, Top = 10, Text = "Register Account", Font = new Font("Arial", 11, FontStyle.Bold) }; Label registerText = new Label() { Left = 10, Top = 40, Text = "User", Font = new Font("Arial", 11, FontStyle.Bold), TextAlign = ContentAlignment.MiddleLeft }; TextBox registerInput = new TextBox() { Left = 10, Top = 70, Font = new Font("Arial", 9), Width = 120, MaxLength = 15 }; Label passText = new Label() { Left = 10, Top = 100, Text = "Password", Font = new Font("Arial", 11, FontStyle.Bold), TextAlign = ContentAlignment.MiddleLeft }; TextBox passInput = new TextBox() { Left = 10, Top = 130, Font = new Font("Arial", 9), Width = 120, PasswordChar = '*' }; Label confirmText = new Label() { Left = 10, Top = 160, Text = "Confirm Password", Font = new Font("Arial", 11, FontStyle.Bold), TextAlign = ContentAlignment.MiddleLeft, Width = 150 }; TextBox confirmInput = new TextBox() { Left = 10, Top = 190, Font = new Font("Arial", 9), Width = 120, PasswordChar = '*' }; Button regButton = new Button { Font = new Font("Arial", 11, FontStyle.Bold), Text = "Register", Dock = DockStyle.Bottom, Height = 40 }; Button cancelButon = new Button { Font = new Font("Arial", 11, FontStyle.Bold), Text = "Cancel", Dock = DockStyle.Bottom, Height = 40, DialogResult = DialogResult.Cancel }; regButton.Click += async(obj, e) => { if (VerifyPassInput(passInput.Text, confirmInput.Text, registerInput.Text)) { var salt = PasswordActions.GenerateSalt(); var reg = await AccountActions.RegisterAccount(new List <string> { $"user={registerInput.Text}", $"password={passInput.Text}", $"salt={salt}" }); if (reg) { MessageBox.Show("Your account was created"); form.Close(); } else { MessageBox.Show("Something went wrong, please try again later"); } } else { MessageBox.Show("Something doesn't seem right here. Make sure the fields are not empty and that the passwords match"); } }; form.Controls.Add(mainText); form.Controls.Add(registerText); form.Controls.Add(registerInput); form.Controls.Add(passText); form.Controls.Add(passInput); form.Controls.Add(confirmText); form.Controls.Add(confirmInput); form.Controls.Add(regButton); form.Controls.Add(cancelButon); form.ShowDialog(); }