mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 11:09:48 -04:00
Refactor organisation invite form for reuse
It’s exactly the same code as `BaseInviteUserForm` so there’s really no need to duplicate it (and means that changes we make to `BaseInviteUserForm` in the future will get inherited).
This commit is contained in:
@@ -1066,16 +1066,8 @@ class BroadcastInviteUserForm(BaseInviteUserForm, BroadcastPermissionsForm):
|
|||||||
raise ValidationError("You cannot send an invitation to yourself")
|
raise ValidationError("You cannot send an invitation to yourself")
|
||||||
|
|
||||||
|
|
||||||
class InviteOrgUserForm(StripWhitespaceForm):
|
class InviteOrgUserForm(BaseInviteUserForm, StripWhitespaceForm):
|
||||||
email_address = email_address(gov_user=False)
|
pass
|
||||||
|
|
||||||
def __init__(self, inviter_email_address, *args, **kwargs):
|
|
||||||
super(InviteOrgUserForm, self).__init__(*args, **kwargs)
|
|
||||||
self.inviter_email_address = inviter_email_address.lower()
|
|
||||||
|
|
||||||
def validate_email_address(self, field):
|
|
||||||
if field.data.lower() == self.inviter_email_address and not current_user.platform_admin:
|
|
||||||
raise ValidationError("You cannot send an invitation to yourself")
|
|
||||||
|
|
||||||
|
|
||||||
class TwoFactorForm(StripWhitespaceForm):
|
class TwoFactorForm(StripWhitespaceForm):
|
||||||
|
|||||||
Reference in New Issue
Block a user