Skip to content

Commit ccc793a

Browse files
committed
fix: don't break on empty play key
1 parent 69823be commit ccc793a

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

app/forms.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222

2323

2424
def validate_play_key(form, field):
25-
"""Validates a field for a valid phone number
25+
"""Validates a field for a valid play kyey
2626
Args:
2727
form: REQUIRED, the field's parent form
2828
field: REQUIRED, the field with data
2929
Returns:
3030
None, raises ValidationError if failed
3131
"""
32-
# jank to get the fireign key that we need back into the field
32+
# jank to get the foreign key that we need back into the field
3333
if current_app.config["REQUIRE_PLAY_KEY"]:
3434
field.data = PlayKey.key_is_valid(key_string=field.data)
35-
return
35+
return True
3636

3737
class CustomRecaptcha(Recaptcha):
3838
def __call__(self, form, field):
@@ -49,10 +49,7 @@ def customize(self, app):
4949
class CustomRegisterForm(RegisterForm):
5050
play_key_id = StringField(
5151
'Play Key',
52-
validators=[
53-
Optional(),
54-
validate_play_key,
55-
]
52+
validators=[validate_play_key]
5653
)
5754
recaptcha = RecaptchaField(
5855
validators=[CustomRecaptcha()]

0 commit comments

Comments
 (0)