# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

from flask_wtf import FlaskForm
from wtforms import TextField, PasswordField
from wtforms.validators import InputRequired, Email, DataRequired

## login and registration

class LoginForm(FlaskForm):
    username = TextField('Username', id='username_login' , validators=[DataRequired()])
    password = PasswordField('Password', id='pwd_login' , validators=[DataRequired()])

class CreateAccountForm(FlaskForm):

    username = TextField('Username' , id='username_create' , validators=[DataRequired()])
    email    = TextField('Email' , id='email_create', validators=[DataRequired(), Email()])
    password = PasswordField('Password' , id='pwd_create' , validators=[DataRequired()])

    # def __init__(self, *args, **kwargs):
    #     if 'formdata' not in kwargs:
    #         kwargs['formdata'] = request.args
    #     if 'csrf_enabled' not in kwargs:
    #         kwargs['csrf_enabled'] = False
    #     super(SearchForm, self).__init__(*args, **kwargs)

    def __init__(self, *args, **kwargs):
        super(CreateAccountForm, self).__init__(*args, **kwargs)