text: from flask_wtf import FlaskForm
  from wtforms import StringField, BooleanField, PasswordField, SubmitField
  from wtforms.validators import DataRequired, Length, Email, EqualTo
  
  
  class RegistrationForm(FlaskForm):
      username = StringField('Username', validators=[DataRequired(), Length(min=4, max=12)])
      email = StringField('Email', validators=[DataRequired(), Email()])
      password = PasswordField('Password', validators=[DataRequired()])
      confirm_password = PasswordField('Confirm Password', validators=[DataRequired(), EqualTo('password')])
  
      submit = SubmitField('Sign Up')
  
  
  def validate_username(self, username):
      if username.data != current_user.username:
          user = User.query.filter_by(username=username.data).first()
          if user:
              raise ValidationError('That username is taken. Please choose another one ')
  
  
  def validate_username(self, email):
      if email.data != current_user.email:
          user = User.query.filter_by(email=email.data).first()
          if user:
              raise ValidationError('That email is taken. Please choose another one ')
  
  
  class LoginForm(FlaskForm):
      email = StringField('Email', validators=[DataRequired(), Email()])
      password = PasswordField('Password', validators=[DataRequired()])
      remember = BooleanField('Remember me')
  
      submit = SubmitField('Log in')
  
  
  class UpdateAccountForm(FlaskForm):
      username = StringField('Username', validators=[DataRequired(), Length(min=2, max=20)])
      email = StringField('Email', validators=[DataRequired(), Email()])
      # picture = FileField('Update Profile Picture', validators=[FileAllowed(['jpg', 'png'])])
      submit = SubmitField('Sign Up')
  
      def validate_username(self, username):
          user = User.query.filter_by(username=username.data).first()
          if user:
              raise ValidationError('That username is taken. Please choose another one ')
  
      def validate_username(self, email):
          user = User.query.filter_by(email=email.data).first()
          if user:
              raise ValidationError('That email is taken. Please choose another one ')
  