diff --git a/app/forms.py b/app/forms.py index d920f4b..e41368d 100644 --- a/app/forms.py +++ b/app/forms.py @@ -1,6 +1,6 @@ from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, BooleanField, SubmitField -from wtforms.validators import ValidationError, DataRequired, Email, EqualTo +from wtforms.validators import ValidationError, DataRequired, EqualTo from app.models import User @@ -21,7 +21,6 @@ class ChannelForm(FlaskForm): class RegistrationForm(FlaskForm): username = StringField('Username', validators=[DataRequired()]) - email = StringField('Email', validators=[DataRequired(), Email()]) password = PasswordField('Password', validators=[DataRequired()]) password2 = PasswordField( 'Repeat Password', validators=[DataRequired(), EqualTo('password')]) @@ -32,10 +31,5 @@ class RegistrationForm(FlaskForm): if user is not None: raise ValidationError('Please use a different username.') - def validate_email(self, email): - user = User.query.filter_by(email=email.data).first() - if user is not None: - raise ValidationError('Please use a different email address.') - class EmptyForm(FlaskForm): submit = SubmitField('Submit') \ No newline at end of file diff --git a/app/models.py b/app/models.py index e765b9d..fc135a7 100644 --- a/app/models.py +++ b/app/models.py @@ -21,7 +21,6 @@ twitter_association = db.Table('twitter_association', class User(UserMixin, db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(64), index=True, unique=True) - email = db.Column(db.String(120), index=True, unique=True) password_hash = db.Column(db.String(128)) posts = db.relationship('Post', backref='author', lazy='dynamic') @@ -33,8 +32,7 @@ class User(UserMixin, db.Model): def check_password(self, password): return check_password_hash(self.password_hash, password) - - # TWITTER + def follow(self, user): if not self.is_following(user): self.followed.append(user) diff --git a/app/routes.py b/app/routes.py index 3e88b9b..559faec 100644 --- a/app/routes.py +++ b/app/routes.py @@ -435,7 +435,7 @@ def register(): if isTwitterUser(form.username.data): flash('This is username is taken! Choose a different one.') else: - user = User(username=form.username.data, email=form.email.data) + user = User(username=form.username.data) user.set_password(form.password.data) db.session.add(user) db.session.commit() diff --git a/app/templates/base.html b/app/templates/base.html index 6d4caf9..528c7f9 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -16,10 +16,10 @@
- {{ form.email.label }}
- {{ form.email(size=64) }}
- {% for error in form.email.errors %}
- [{{ error }}]
- {% endfor %}
-
{{ form.password.label }}
{{ form.password(size=32) }}