add another check on seed inputs

This commit is contained in:
lza_menace 2020-12-29 21:43:46 -08:00
parent f2677349dc
commit d0b573a11c

View file

@ -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")