From d0b573a11cb32b22797a477c3e8c886fd2339eac Mon Sep 17 00:00:00 2001 From: lza_menace Date: Tue, 29 Dec 2020 21:43:46 -0800 Subject: [PATCH] add another check on seed inputs --- wowstash/forms.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wowstash/forms.py b/wowstash/forms.py index 69b88d3..8afc725 100644 --- a/wowstash/forms.py +++ b/wowstash/forms.py @@ -1,3 +1,4 @@ +from re import match as re_match from flask_wtf import FlaskForm from wtforms import StringField, BooleanField from wtforms.validators import DataRequired, ValidationError @@ -26,5 +27,8 @@ class Restore(FlaskForm): risks_accepted = BooleanField('I accept the risks:', validators=[DataRequired()], render_kw={"class": "form-control-span"}) def validate_seed(self, seed): + regex = '^[\w\s]+$' + if bool(re_match(regex, self.seed.data)) is False: + raise ValidationError('Invalid seed provided; must be alphanumeric characters only') if len(self.seed.data.split()) != 25: raise ValidationError("Invalid seed provided; must be standard Wownero 25 word format")