CPI Ordering System (the old version)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 

42 lines
1.1 KiB

import colander
import deform
from . import CSRFSchema
from .helpers import deferred_unique_email_validator
# schema for user registration
class RegistrationSchema(CSRFSchema):
''' new user registration '''
user_name = colander.SchemaNode(
colander.String(),
widget=deform.widget.TextInputWidget(),
description='automagically generated for you',
missing=''
)
first_name = colander.SchemaNode(
colander.String()
)
last_name = colander.SchemaNode(
colander.String()
)
email = colander.SchemaNode(
colander.String(),
validator=deferred_unique_email_validator
)
password = colander.SchemaNode(
colander.String(),
widget=deform.widget.CheckedPasswordWidget()
)
@classmethod
def as_form(cls, request, **override):
settings = {
'buttons': ('Create Account', 'Cancel'),
'css_class': 'form-horizontal registration'
}
settings.update(override)
return super().as_form(request, **settings)