Example #1
0
        public string ResetPassword()
        {
            string pass = Guid.NewGuid().ToString().Substring(0, 6);

            Password = ValidationPassword.Encrypt(pass);
            return(pass);
        }
        public void GivenAnStringReturnValueEncripty()
        {
            var password           = "******";
            var password_encripted = ValidationPassword.Encrypt(password);

            Assert.AreNotEqual(password, password_encripted);
        }
        public void ValidationPasswordValueCompareNewWithOld()
        {
            User user = new User(0, Name, Email, Password, Permission, true);

            Assert.AreEqual(user.Password, ValidationPassword.Encrypt(Password));
            user.ResetPassword();
            Assert.AreNotEqual(user.Password, ValidationPassword.Encrypt(Password));
        }
Example #4
0
        public bool Authenticate(string email, string password)
        {
            if (Email == email && Password == ValidationPassword.Encrypt(password))
            {
                return(true);
            }

            AddNotification("User", "Usuário ou senha inválido");
            return(false);
        }
Example #5
0
        public User(int id, string email, string password, string nickname, EPermission permission, bool enabled)
        {
            Id         = id;
            Email      = email;
            Password   = password;
            Nickname   = nickname;
            Permission = permission;
            Enabled    = enabled;

            Validate();
            Password = ValidationPassword.Encrypt(Password);
        }
Example #6
0
        public User(int id, string username, string email, string password, EPermission permission, bool active)
        {
            Id         = id;
            Username   = username;
            Email      = email.ToLower();
            Password   = password;
            Permission = permission;
            Active     = active;

            Validate();

            Password = ValidationPassword.Encrypt(password);
        }