Ejemplo n.º 1
0
 def __init__(self, fieldname, message):
     Validator.__init__(self, message, None)
     self.fieldname = fieldname
     self.form = None
Ejemplo n.º 2
0
def find_account(username=None, lusername=None, email=None):
    return accounts.find(username=username, lusername=lusername, email=email)

def find_ia_account(email=None):
    ia_account = InternetArchiveAccount.get(email=email)
    return ia_account

Login = Form(
    Textbox('username', description=_('Username'), klass='required'),
    Password('password', description=_('Password'), klass='required'),
    Hidden('redirect')
)
forms.login = Login

email_already_used = Validator(_("No user registered with this email address"), lambda email: find_account(email=email) is not None)
email_not_already_used = Validator(_("Email already registered"), lambda email: not find_ia_account(email=email))
email_not_disposable = Validator(_("Disposable email not permitted"), lambda email: not email.lower().endswith('dispostable.com'))
email_domain_not_blocked = Validator(_("Your email provider is not recognized."), lambda email: not spamcheck.is_spam_email(email))
username_validator = Validator(_("Username already used"), lambda username: not find_account(lusername=username.lower()))

vlogin = RegexpValidator(r"^[A-Za-z0-9-_]{3,20}$", _('Must be between 3 and 20 letters and numbers'))
vpass = RegexpValidator(r".{3,20}", _('Must be between 3 and 20 characters'))
vemail = RegexpValidator(r".*@.*", _("Must be a valid email address"))

class EqualToValidator(Validator):
    def __init__(self, fieldname, message):
        Validator.__init__(self, message, None)
        self.fieldname = fieldname
        self.form = None
Ejemplo n.º 3
0
 def __init__(self, fieldname, message):
     Validator.__init__(self, message, None)
     self.fieldname = fieldname
     self.form = None
Ejemplo n.º 4
0

def find_account(username=None, lusername=None, email=None):
    import account
    return account.Account.find(username=username,
                                lusername=lusername,
                                email=email)


Login = Form(Textbox('username', description=_('Username'), klass='required'),
             Password('password', description=_('Password'), klass='required'),
             Hidden('redirect'))
forms.login = Login

email_already_used = Validator(
    _("No user registered with this email address"),
    lambda email: find_account(email=email) is not None)
email_not_already_used = Validator(
    _("Email already used"), lambda email: find_account(email=email) is None)
email_not_disposable = Validator(
    _("Disposable email not permitted"),
    lambda email: not email.lower().endswith('dispostable.com'))
username_validator = Validator(
    _("Username already used"),
    lambda username: not find_account(lusername=username.lower()))

vlogin = RegexpValidator(r"^[A-Za-z0-9-_]{3,20}$",
                         _('Must be between 3 and 20 letters and numbers'))
vpass = RegexpValidator(r".{3,20}", _('Must be between 3 and 20 characters'))
vemail = RegexpValidator(r".*@.*", _("Must be a valid email address"))