Skip to content

Commit 3756923

Browse files
committed
Added username validation to the change username form, to avoid database key collision exceptions. Instead give a message to contact the secretariat to resolve the situation.
- Legacy-Id: 15490
1 parent b11afc0 commit 3756923

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

ietf/ietfauth/forms.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,9 @@ def clean_password(self):
256256
if not self.user.check_password(password):
257257
raise ValidationError('Invalid password')
258258
return password
259+
260+
def clean_username(self):
261+
username = self.cleaned_data['username']
262+
if User.objects.filter(username=username).exists():
263+
raise ValidationError("A login with that username already exists. Please contact the secretariat to get this resolved.")
264+
return username

0 commit comments

Comments
 (0)