-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforms.py
More file actions
17 lines (16 loc) · 758 Bytes
/
forms.py
File metadata and controls
17 lines (16 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField, BooleanField
from wtforms.validators import DataRequired, Length, Email, EqualTo, ValidationError
import sqlite3
class LoginForm(FlaskForm):
email = StringField('Email',validators=[DataRequired(),Email()])
password = PasswordField('Password',validators=[DataRequired()])
remember = BooleanField('Remember Me')
submit = SubmitField('Login')
def validate_email(self, email):
conn = sqlite3.connect('heart.db')
curs = conn.cursor()
curs.execute("SELECT email FROM user where email = (?)",[email.data])
valemail = curs.fetchone()
if valemail is None:
raise ValidationError('This Email ID is not registered. Please register before login')