Commit b33626c6 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou Committed by Georgios D. Tsoukalas
Browse files

Ensure only verified users are added to a project

since users get registered at quotaholder during the activation process
(qh_register_user_with_quotas call in `activate` method -- im/functions.py).

An additional safer check in `create_membership` method might be
necessary.
parent 31f07c85
......@@ -916,7 +916,7 @@ class AddProjectMembersForm(forms.Form):
q = self.cleaned_data.get('q') or ''
users = q.split(',')
users = list(u.strip() for u in users if u)
db_entries = AstakosUser.objects.filter(email__in=users)
db_entries = AstakosUser.objects.verified().filter(email__in=users)
unknown = list(set(users) - set(u.email for u in db_entries))
if unknown:
raise forms.ValidationError(
......
......@@ -453,6 +453,8 @@ def create_membership(project, user):
project = get_project_by_id(project)
if isinstance(user, int):
user = get_user_by_id(user)
#TODO: low level check on whether user is registered in quotaholder
m = ProjectMembership(
project=project,
person=user,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment