Skip to content

Commit

Permalink
Fixup. Format code with Black
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Sep 21, 2023
1 parent 1a2953e commit 3d227bc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pod/playlist/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def create_new_favorites(self):
"visibility": "private",
"autoplay": True,
"editable": False,
}
},
)
# Converting previous favorites to new system
for owner_id, data_lists in FAVORITES_DATA.items():
Expand Down
6 changes: 4 additions & 2 deletions pod/video/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ def update_video_passwords(sender, **kwargs):
from pod.video.models import Video
from django.contrib.auth.hashers import make_password
from django.db.models import Q

# Filter insecure protected videos
videos_to_update = Video.objects.filter(
Q(password__isnull=False) & ~Q(password__startswith=('pbkdf2', 'sha256$')))
Q(password__isnull=False) & ~Q(password__startswith=("pbkdf2", "sha256$"))
)
for video in videos_to_update:
video.password = make_password(video.password, hasher='pbkdf2_sha256')
video.password = make_password(video.password, hasher="pbkdf2_sha256")
video.save()


Expand Down
6 changes: 4 additions & 2 deletions pod/video/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,9 @@ class Video(models.Model):
)
password = models.CharField(
_("password"),
help_text=_("Viewing this video will not be possible without this password.") + " " + _("The password is / will be encrypted.") ,
help_text=_("Viewing this video will not be possible without this password.")
+ " "
+ _("The password is / will be encrypted."),
max_length=50,
blank=True,
null=True,
Expand Down Expand Up @@ -861,7 +863,7 @@ class Meta:

def set_password(self):
"""Encrypt the password if video is protected. An encrypted password cannot be re-encrypted."""
if self.password and not self.password.startswith(('pbkdf2', 'sha256$')):
if self.password and not self.password.startswith(("pbkdf2", "sha256$")):
self.password = make_password(self.password, hasher="pbkdf2_sha256")

def save(self, *args, **kwargs):
Expand Down

0 comments on commit 3d227bc

Please sign in to comment.