Beispiel #1
0
        public UserManageResult SetPassword(string id, SecureString password)
        {
            bool passwordIsValid = validatePassword(password.Unsecure());

            if (!passwordIsValid)
            {
                return new UserManageResult {
                           Success = false,
                           Errors  = new List <string> {
                               "Password does not meet minimum complexity requirements."
                           }
                }
            }
            ;

            byte[]       salt = CryptoTools.CreateSalt();
            IdentityUser user = _bifUserStore.LoadUserById(id);

            user.Entropy      = salt;
            user.PasswordHash = password.HashValue(salt);

            _bifUserStore.Update();

            return(new UserManageResult {
                Success = true
            });
        }