mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 08:16:51 -04:00
Move two calls to str.lower next to each other
This means that we can rewrite `validate_email_address` to do a different comparison without having to also change `__init__` I’ve moved the platform admin check into its own conditional to keep the line length manageable.
This commit is contained in:
@@ -1044,10 +1044,12 @@ class BaseInviteUserForm():
|
||||
|
||||
def __init__(self, invalid_email_address, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.invalid_email_address = invalid_email_address.lower()
|
||||
self.invalid_email_address = invalid_email_address
|
||||
|
||||
def validate_email_address(self, field):
|
||||
if field.data.lower() == self.invalid_email_address and not current_user.platform_admin:
|
||||
if current_user.platform_admin:
|
||||
return
|
||||
if field.data.lower() == self.invalid_email_address.lower():
|
||||
raise ValidationError("You cannot send an invitation to yourself")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user