from flask_wtf import Form
from wtforms import TextField, PasswordField
from wtforms.validators import DataRequired, Length, Email, EqualTo


class Contacts(Form):
	name = TextField('Name', validators=[DataRequired(), Length(max=15)])
	phone = TextField(
	    'Phone', validators=[DataRequired(), Length(max=11)])
	sex = TextField(
	    'Sex', validators=[Length(max=6)])
	add = TextField('Address', validators=[Length(max=60)])
	rel = TextField('Relationship', validators=[DataRequired()])

class LoginForm(Form):
    username = TextField('Username', validators=[DataRequired()])
    password = PasswordField('Password', validators=[DataRequired()])


class RegisterForm(Form):
    username = TextField(
        'username',
        validators=[DataRequired(), Length(min=3, max=25)]
    )
    email = TextField(
        'email',
        validators=[DataRequired(), Email(message=None), Length(min=6, max=40)]
    )
    password = PasswordField(
        'password',
        validators=[DataRequired(), Length(min=6, max=25)]
    )
    confirm = PasswordField(
        'Repeat password',
        validators=[
            DataRequired(), EqualTo('password', message='Passwords must match.')
        ]
    )
