Skip to content

Commit

Permalink
[fix] Disable PUT for user api, deny empty email (#1513)
Browse files Browse the repository at this point in the history
  • Loading branch information
triklozoid committed Sep 23, 2021
1 parent 5f370b5 commit eb75e18
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion label_studio/users/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from rest_framework.decorators import action
from rest_framework import generics
from rest_framework.permissions import IsAuthenticated
from rest_framework.exceptions import MethodNotAllowed

from core.permissions import all_permissions, ViewClassPermission
from users.models import User
Expand Down Expand Up @@ -90,7 +91,7 @@ def avatar(self, request, pk):
return Response(status=204)

def update(self, request, *args, **kwargs):
return super(UserAPI, self).update(request, *args, **kwargs)
raise MethodNotAllowed('PUT')

def list(self, request, *args, **kwargs):
return super(UserAPI, self).list(request, *args, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion label_studio/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class User(UserMixin, AbstractBaseUser, PermissionsMixin, UserLastActivityMixin)
Username and password are required. Other fields are optional.
"""
username = models.CharField(_('username'), max_length=256, blank=True)
username = models.CharField(_('username'), max_length=256)
email = models.EmailField(_('email address'), unique=True, blank=True)

first_name = models.CharField(_('first name'), max_length=256, blank=True)
Expand Down

0 comments on commit eb75e18

Please sign in to comment.