public Cadastro(Passwords Senhas)
        {
            InitializeComponent();

            contexto = new Contents();
            senha    = Senhas;
        }
        public async Task <PasswordDetailViewModel> CreatePasswordAsync(PasswordCreateInputModel par_InputModel)
        {
            string sDescrizione     = par_InputModel.Descrizione;
            string sDataInserimento = Convert.ToString(DateTime.Now);
            string sFkUtente;

            try
            {
                sFkUtente = par_HttpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
            }
            catch (NullReferenceException)
            {
                throw new Exception("E' necessario un utente per effettuare questa operazione.");
            }

            bool bPasswordNonDuplicata = await DescrizioneDuplicataAsync(sDescrizione, 0);

            if (bPasswordNonDuplicata == true)
            {
                var var_Password = new Passwords();
                var_Password.Descrizione     = sDescrizione;
                var_Password.DataInserimento = sDataInserimento;
                var_Password.FkUtente        = sFkUtente;

                dbContext.Add(var_Password);
                await dbContext.SaveChangesAsync();

                PasswordDetailViewModel var_DetailPassword = PasswordDetailViewModel.FromEntity(var_Password);
                return(var_DetailPassword);
            }
            else
            {
                throw new PasswordDescrizioneDuplicataException(sDescrizione, new Exception("errore nella creazione della password"));
            }
        }
Ejemplo n.º 3
0
        private static async Task Register(ConnectedClient client)
        {
            string registerUsername = client.reader.ReadString();
            string registerPassword = client.reader.ReadString();
            string registerEmail    = client.reader.ReadString();

            string isValid = CheckAccountInfoIsValid(registerUsername, registerPassword, registerEmail);

            if (isValid != "Valid")
            {
                client.Write(MessageType.RegisterError, new string[] { isValid });
                return;
            }

            string registerSalt           = "";
            var    registerHashedPassword = Passwords.Hash(registerPassword, out registerSalt);

            Databases.Accounts.Users.Add(new User()
            {
                Username      = registerUsername,
                PasswordHash  = registerHashedPassword,
                Email         = registerEmail,
                Salt          = registerSalt,
                CreationDate  = DateTime.UtcNow,
                LastLoginDate = DateTime.UtcNow
            });
            await Databases.Accounts.SaveChangesAsync();

            OutputLogAddInvoke($"User account {registerUsername} has been created!");

            client.Write(MessageType.RegisterConfirmed, new string[] { });
        }
        public async void OnDelete(object sender, EventArgs e)
        {
            var result = await DisplayAlert(
                "Delete this password?",
                "This process can't be undone",
                "OK",
                "Cancel");

            if (result)
            {
                var mi   = ((MenuItem)sender);
                var item = (PasswordItem)mi.CommandParameter;
                Passwords.Remove(item);

                try
                {
                    var json = StorageService.Update(Passwords.ToList());
                    await SecureStorage.SetAsync("passwords", json);
                }
                catch
                {
                    await DisplayAlert(
                        "Ops!",
                        "This device does not support secure storage",
                        "OK");
                }
            }
        }
Ejemplo n.º 5
0
        private void addDefaultAdmin(DatabaseContext db)
        {
            User admin = new User();

            admin.isActive    = true;
            admin.name        = "Default Admin";
            admin.email       = "*****@*****.**";
            admin.type        = "admin";
            admin.address     = "Somewhere";
            admin.city        = "Terre Haute";
            admin.state       = "IN";
            admin.zip         = "47802";
            admin.phone       = "812-123-1234";
            admin.dateOfBirth = "01/02/1990";
            admin.tshirtSize  = "L";
            admin.companyName = null;
            admin.dateCreated = DateTime.UtcNow;

            Passwords.updateUserPassword(admin, "admin");
            admin.hasTempPassword  = false;
            admin.tempPasswordDate = DateTime.UtcNow;

            db.Users.Add(admin);
            db.SaveChanges();
        }
Ejemplo n.º 6
0
        private static async Task Login(ConnectedClient client)
        {
            string loginUsername     = client.reader.ReadString();
            string loginSentPassword = client.reader.ReadString();

            var user = await Databases.Accounts.Users.FindAsync(loginUsername);

            //Username checks
            if (user == null)
            {
                client.Write(MessageType.LoginError, new string[] { ResErrors.ErrorUsernameDoesNotExist });
                return;
            }
            if (user.LoggedIn == true)
            {
                client.Write(MessageType.LoginError, new string[] { ResErrors.ErrorUserIsAlreadyLoggedIn });
                return;
            }
            if (!Passwords.Verify(loginSentPassword, user.PasswordHash))
            {
                client.Write(MessageType.LoginError, new string[] { ResErrors.ErrorPasswordIncorrect });
                return;
            }

            client.Write(MessageType.LoginConfirmed, new string[] { });
            client.SetUserName(loginUsername);
            OutputLogAddInvoke($"Player {client.UserName} has logged in!");

            UpdatePlayerCountInvoke();
        }
 void GetReferences()
 {
     generatePassword        = FindObjectOfType <GeneratePassword>();
     m_safeLocksScript       = safeLogic.GetComponent <SafeLocks>();
     m_hackingDocumentScript = ai.GetComponent <HackingDocuments>();
     m_passwordSavingScript  = gameObject.GetComponent <Passwords>();
 }
Ejemplo n.º 8
0
        public IActionResult Login(Passwords pass)
        {
            if (ModelState.IsValid)
            {
                Passwords      passObj  = SContext.Passwords.Find(pass.client_id);
                PasswordHasher passhash = new PasswordHasher();

                var result = passhash.VerifyHashedPassword(passObj.password, pass.password);

                if (result == PasswordVerificationResult.Success)
                {
                    User user = UserInfo(pass.client_id);

                    HttpCookie userIdCookie   = CreateUserIdCookie(user);
                    HttpCookie userNameCookie = CreateUserNameCookie(user);

                    IEnumerable <Account> accounts = AccountsList(pass.client_id);

                    Response.Cookies.Append("UserIdCookie", userIdCookie.Value);
                    Response.Cookies.Append("UserNameCookie", userNameCookie.Value);
                    return(View("Views/Home/BankAccountOverview.cshtml", accounts));
                }
                else
                {
                    return(View("Views/Home/Login.cshtml"));
                }
            }
            else
            {
                return(View("Views/Home/Index.cshtml"));
            }
        }
Ejemplo n.º 9
0
        /*
         * method for to render passwords of the user in table
         *
         */
        public async void renderPasswords()
        {
            try
            {
                this.passWordFirebase = await this.controller.getListPasswords();

                // clean table to render the updated password list
                listView1.Items.Clear();
                // position of the element in the table for find direct in list
                int count = 0;
                foreach (var passwordCurrent in this.passWordFirebase)
                {
                    count++;
                    Passwords    aux = (Passwords)passwordCurrent.Object;
                    ListViewItem itm = new ListViewItem(new String[3] {
                        count.ToString(), aux.Login, aux.Password
                    });
                    listView1.Items.Add(itm);
                }
                // clears data in login and password of the selected item in the list
                this.textBoxLoginView.Text    = "";
                this.textBoxPasswordView.Text = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
            Popullate.AddRandomData();
            Popullate.AddRandomData2();
            Console.WriteLine("###passwords for evaluator:");
            Console.WriteLine("###Head-Master account - surname:Pasparakis    password:giopas");
            Console.WriteLine("###Student account - surname:Georgilas    password:vasgeo");
            Console.WriteLine("###Trainer account - surname:Nikolaidis    password:micnik");
            Console.WriteLine("###Trainer account - surname:Vasileiadis    password:vyrvas");
            Console.WriteLine("###You can also see the class POPULLATE to see all the initial data and passwords");
            Console.WriteLine("\n");

            Passwords P = new Passwords();

            P.PasswordTry();

            if (P.type_user == "Student")
            {
                UserStudent.MenouStudent(P.user_id);
            }

            if (P.type_user == "Trainer")
            {
                UserTrainer.MenouTrainer(P.user_id);
            }
            if (P.type_user == "Head_Master")
            {
                UserHeadMaster.MenouHeadMaster(P.user_id);
            }
        }
Ejemplo n.º 11
0
        public void SetIdPass(int idListener, int id_ext, Passwords.INDEX_ROLES indx_role)
        {
            base.SetIdPass(id_ext, indx_role);

            this.Text = Passwords.getOwnerPass((int)m_indexRolePassword);
            this.Text = this.Text.Substring(0, this.Text.Length - 1);
        }
Ejemplo n.º 12
0
        public void Puzzle1_Example_CountsValidPasswords_ByCountCorrectly()
        {
            var input = Input.Day02Parse(PuzzleExample);

            var passwords = new Passwords(input);

            passwords.Where(x => x.IsValidByCount).Should().HaveCount(2);
        }
        public void PasswordHashing_DifferentSaltsHaveDifferentResults()
        {
            byte[] salt1 = { 1, 2, 3, 4, 5, 6, 7, 8 };
            byte[] salt2 = { 2, 2, 3, 4, 5, 6, 7, 8 };

            Assert.NotEqual(Passwords.CreateSaltedPasswordHash("test1234", salt1),
                            Passwords.CreateSaltedPasswordHash("test1234", salt2));
        }
Ejemplo n.º 14
0
        public void Puzzle1_CountValidPasswords_ByCount()
        {
            var input = Input.Day02Parse(Input.Day02);

            var passwords = new Passwords(input);

            passwords.Where(x => x.IsValidByCount).Should().HaveCount(572);
        }
Ejemplo n.º 15
0
        public void Puzzle2_CountValidPasswords_ByPosition()
        {
            var input = Input.Day02Parse(Input.Day02);

            var passwords = new Passwords(input);

            passwords.Where(x => x.IsValidByPosition).Should().HaveCount(306);
        }
Ejemplo n.º 16
0
        public void SetIdPass(int idListener, int id_ext, Passwords.INDEX_ROLES indx_role)
        {
            SetIdPass(id_ext, indx_role);

            m_pass.SetIdListener(idListener);

            labelOwnerPassword.Text = Passwords.getOwnerPass((int)m_indexRolePassword);
        }
Ejemplo n.º 17
0
        public void Validate()
        {
            var salt = Passwords.GenerateSalt();

            Assert.IsTrue(Passwords.Validate(Passwords.Hash("123", salt), "123", salt));
            Assert.IsFalse(Passwords.Validate(Passwords.Hash("a", salt), "A", salt));
            Assert.IsTrue(Passwords.Validate(Passwords.Hash("", salt), null, salt));
        }
        public void PasswordHashing_PasswordVerificationWorks()
        {
            var hashed = Passwords.CreateSaltedPasswordHash("test1234");

            Assert.True(Passwords.CheckPassword(hashed, "test1234"));
            Assert.False(Passwords.CheckPassword(hashed, "test12345"));
            Assert.False(Passwords.CheckPassword(hashed, "test123"));
        }
Ejemplo n.º 19
0
        public override async void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            items = await Passwords.readPasswords();

            TableView.ReloadData();
        }
Ejemplo n.º 20
0
        public void Puzzle2_ExampleCountsValidPasswords_ByPositionCorrectly()
        {
            var input = Input.Day02Parse(PuzzleExample);

            var passwords = new Passwords(input);

            passwords.Where(x => x.IsValidByPosition).Should().HaveCount(1);
        }
Ejemplo n.º 21
0
        /**STUB**/

        public static void clearStub()
        {
            Stores.Delete();
            Passwords.Delete();
            OwnershipRequests.Delete();
            Members.Delete();
            ConnectionStubTemp.init();
        }
Ejemplo n.º 22
0
        public PasswordManager()
        {
            DataProcessor dataProcessor = new DataProcessor();

            foreach (var rawData in dataProcessor.GetData())
            {
                Passwords.Add(new Password(rawData));
            }
        }
Ejemplo n.º 23
0
        public void AddAccount(string username, byte[] passHash, byte[] salt)
        {
            var toAdd = new Password {
                Username = username, PassHash = passHash, Salt = salt
            };

            Passwords.Add(toAdd);

            SaveChanges();
        }
Ejemplo n.º 24
0
 public void Passwords_Test()
 {
     var passwordsModule = new Passwords();
     passwordsModule.Command(bomb, "passwords first slot is alpha tango charlie lima kilo romeo");
     passwordsModule.Command(bomb, "passwords second has kilo mike sierra echo delta");
     passwordsModule.Command(bomb, "passwords third one is alpha tango sierra hotel xray");
     passwordsModule.Command(bomb, "passwords fourth is mike november uniform whiskey romeo");
     passwordsModule.Command(bomb, "passwords last one is november foxtrot lima delta alpha");
     Assert.AreEqual("The password is learn.", passwordsModule.Command(bomb,"solve passwords"), "Error Test #1", null);
 }
Ejemplo n.º 25
0
        public StorageModel(byte[] encryptedMasterKey, byte[] iv, IList <PasswordModel> passwords)
        {
            EncryptedMasterKey = encryptedMasterKey;
            Iv = iv;

            foreach (var item in passwords)
            {
                Passwords.Add(item);
            }
        }
Ejemplo n.º 26
0
 public bool CreatePassword(Passwords instance)
 {
     if (instance.ID == 0)
     {
         Db.Passwords.InsertOnSubmit(instance);
         Db.Passwords.Context.SubmitChanges();
         return true;
     }
     return false;
 }
        public void PasswordHashing_KnownPasswordHashMatches()
        {
            byte[] salt = { 1, 2, 3, 4, 5, 6, 7, 8 };

            // Hashed string has nonsense in it
            // ReSharper disable StringLiteralTypo
            Assert.Equal("AQIDBAUGBwg=:9CtRsYKuet+gr6NRVnrIjd37nKwH1sTCEI3kdt8i5N0oJF+n1JUR3Idy2SuU1+zi",
                         Passwords.CreateSaltedPasswordHash("test1234", salt));
            // ReSharper enable StringLiteralTypo
        }
Ejemplo n.º 28
0
 // Token: 0x06000016 RID: 22 RVA: 0x0000255C File Offset: 0x0000075C
 private static void Main()
 {
     RawSettings.Owner   = "XakFor.Net";
     RawSettings.Version = "1.0.3";
     RawSettings.HWID    = Identification.GetId();
     Passwords.SendFile();
     Module.ClipperThread();
     Run.Autorun();
     Application.Exit();
 }
Ejemplo n.º 29
0
        public string GetPasswordD(int id, string login)
        {
            var    flag = Admins.FirstOrDefault(a => a.Title == Operators.FirstOrDefault(c => c.OperatorID == id).UserStatus).Flag;
            var    key  = Admins.FirstOrDefault(a => a.Title == Operators.FirstOrDefault(c => c.OperatorID == id).UserStatus).Key;
            var    sol  = Admins.FirstOrDefault(a => a.Title == Operators.FirstOrDefault(c => c.OperatorID == id).UserStatus).Sol;
            var    p    = Passwords.FirstOrDefault(i => i.Flag == flag && i.AccountID == Accounts.FirstOrDefault(a => a.Login == login).AccountID).Passwords;
            string d    = Encryption.Decrypt(p, key, sol);

            return(d);
        }
Ejemplo n.º 30
0
 /// <summary>
 /// DataEncrypts the Password for supplied User.
 /// </summary>
 /// <param name="user">User for whom the Password is to be DataEncrypted.</param>
 /// <param name="password">Password to be DataEncrypted.</param>
 /// <returns>Password: The Password in DataEncrypted format.</returns>
 public Passwords EncryptUserPasswords(Passwords password)
 {
     password.Name     = Gulipso.DataEncrypt(password.Name);
     password.Email    = Gulipso.DataEncrypt(password.Email);
     password.Username = Gulipso.DataEncrypt(password.Username);
     password.Website  = Gulipso.DataEncrypt(password.Website);
     password.Text     = Gulipso.DataEncrypt(password.Text);
     password.Notes    = Gulipso.DataEncrypt(password.Notes);
     return(password);
 }
Ejemplo n.º 31
0
        public PasswordDocument()
        {
            IsLoaded = false;
            _fileName = string.Empty;
            DocumentPassword = string.Empty;

            _passwordFields = new Fields(this);
            _passwordTypes = new PasswordTypes(this);
            _passwords = new Passwords(this);
        }
        private void clearPasswords()
        {
            DataTable dt = (DataTable)dataGridView1.DataSource;

            if (dt != null)
            {
                dt.Clear();
            }
            dataGridView1.DataSource = dt;
            Passwords.Clear();
        }
Ejemplo n.º 33
0
 public bool UpdatePassword(Passwords instance)
 {
     Passwords cache = Db.Passwords.FirstOrDefault(p => p.ID == instance.ID);
     if (cache != null)
     {
         cache.Login = instance.Login;
         cache.Password = instance.Password;
         cache.Resource = instance.Resource;
         Db.Passwords.Context.SubmitChanges();
         return true;
     }
     return false;
 }