コード例 #1
0
ファイル: UnitTest.cs プロジェクト: dannisliang/PurpleScripts
        public void Password_Fail()
        {
            string password = "******";
            PurplePassword PurplePasswordInstance = new PurplePassword ();
            string passwordHash = PurplePasswordInstance.CreateHash (password);

            Assert.IsFalse(PurplePasswordInstance.ValidatePassword ("WrongPassword987?", passwordHash));
        }
コード例 #2
0
        private static bool create_database_user(PurpleAccount user, string password)
        {
            PurplePassword PuPa = new PurplePassword ();
            user.password = PuPa.CreateHash(password);
            user.NewGuid();
            user.account_created = DateTime.Now;
            user.account_type = "User";
            user.active = false;

            if(PurpleAttributes.Validator.Validate (user, out errorList))
            {
                int result = user.ToSQLInsert ().Execute ();
                if(result == 1)
                    PurpleMailGenerator.SendMail(PurpleConfig.Mail.Template.Register, user);
                return (result==1) ? true : false;
            }
            return false;
        }
コード例 #3
0
ファイル: UnitTest.cs プロジェクト: dannisliang/PurpleScripts
        public void Password()
        {
            string password = "******";
            PurplePassword PurplePasswordInstance = new PurplePassword ();
            string passwordHash = PurplePasswordInstance.CreateHash (password);

            Assert.IsTrue(PurplePasswordInstance.ValidatePassword (password, passwordHash));
        }