2020-12-30 08:43:23 +00:00
|
|
|
from re import match as re_match
|
2020-08-25 20:48:50 +01:00
|
|
|
from flask_wtf import FlaskForm
|
2020-08-27 06:50:08 +01:00
|
|
|
from wtforms import StringField, BooleanField
|
2020-12-30 08:43:23 +00:00
|
|
|
from wtforms.validators import DataRequired, ValidationError
|
2020-08-25 20:48:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Register(FlaskForm):
|
|
|
|
email = StringField('Email Address:', validators=[DataRequired()], render_kw={"placeholder": "Email", "class": "form-control", "type": "email"})
|
|
|
|
password = StringField('Password:', validators=[DataRequired()], render_kw={"placeholder": "Password", "class": "form-control", "type": "password"})
|
2020-08-27 06:50:08 +01:00
|
|
|
faq_reviewed = BooleanField('FAQ Reviewed:', validators=[DataRequired()], render_kw={"class": "form-control-span"})
|
|
|
|
terms_reviewed = BooleanField('Terms Reviewed:', validators=[DataRequired()], render_kw={"class": "form-control-span"})
|
|
|
|
privacy_reviewed = BooleanField('Privacy Policy Reviewed:', validators=[DataRequired()], render_kw={"class": "form-control-span"})
|
|
|
|
|
|
|
|
class Login(FlaskForm):
|
|
|
|
email = StringField('Email Address:', validators=[DataRequired()], render_kw={"placeholder": "Email", "class": "form-control", "type": "email"})
|
|
|
|
password = StringField('Password:', validators=[DataRequired()], render_kw={"placeholder": "Password", "class": "form-control", "type": "password"})
|
2020-09-11 21:59:48 +01:00
|
|
|
|
|
|
|
class Send(FlaskForm):
|
|
|
|
address = StringField('Destination Address:', validators=[DataRequired()], render_kw={"placeholder": "Wownero address", "class": "form-control"})
|
2020-09-21 19:42:17 +01:00
|
|
|
amount = StringField('Amount:', validators=[DataRequired()], render_kw={"placeholder": "Amount to send or \"all\"", "class": "form-control"})
|
2020-09-25 08:10:48 +01:00
|
|
|
|
|
|
|
class Delete(FlaskForm):
|
|
|
|
confirm = BooleanField('Confirm Account and Wallet Deletion:', validators=[DataRequired()], render_kw={"class": "form-control-span"})
|
2020-12-30 08:43:23 +00:00
|
|
|
|
|
|
|
class Restore(FlaskForm):
|
|
|
|
seed = StringField('Seed Phrase', validators=[DataRequired()], render_kw={"placeholder": "25 word mnemonic seed phrase", "class": "form-control"})
|
|
|
|
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")
|
2021-05-07 07:46:18 +01:00
|
|
|
|
|
|
|
class ResetPassword(FlaskForm):
|
|
|
|
password = StringField('Password', validators=[DataRequired()], render_kw={"placeholder": "Password", "type": "password"})
|
|
|
|
password_confirmed = StringField('Confirm Password', validators=[DataRequired()], render_kw={"placeholder": "Confirm Password", "type": "password"})
|
|
|
|
|
|
|
|
def validate_password(self, password):
|
|
|
|
if self.password.data != self.password_confirmed.data:
|
|
|
|
raise ValidationError('Passwords do not match')
|