Пример #1
0
def get_password_schema():
    """
    Return the schema for user password change

    :returns: a colander Schema
    """
    schema = SQLAlchemySchemaNode(
        Login,
        includes=('pwd_hash', ),
        title=u'',
    )
    set_widgets(schema)

    schema.insert(
        0,
        colander.SchemaNode(
            colander.String(),
            widget=deform.widget.PasswordWidget(),
            name='password',
            title=u'Mot de passe actuel',
            default=u'',
        ))

    schema['pwd_hash'].title = u"Nouveau mot de passe"
    schema.validator = deferred_password_validator
    schema.after_bind = remove_actual_password_my_account

    return schema
Пример #2
0
def get_password_schema():
    """
    Return the schema for user password change

    :returns: a colander Schema
    """
    schema = SQLAlchemySchemaNode(
        Login,
        includes=('pwd_hash',),
        title=u'',
    )
    set_widgets(schema)

    schema.insert(
        0,
        colander.SchemaNode(
            colander.String(),
            widget=deform.widget.PasswordWidget(),
            name='password',
            title=u'Mot de passe actuel',
            default=u'',
        )
    )

    schema['pwd_hash'].title = u"Nouveau mot de passe"
    schema.validator = deferred_password_validator
    schema.after_bind = remove_actual_password_my_account

    return schema
Пример #3
0
def get_company_customer_schema():
    """
    return the schema for user add/edit regarding the current user's role
    """
    schema = SQLAlchemySchemaNode(Customer)
    schema = _customize_schema(schema)
    schema['name'].missing = colander.required
    schema.after_bind = _customer_after_bind
    return schema
Пример #4
0
def get_company_customer_schema():
    """
    return the schema for user add/edit regarding the current user's role
    """
    schema = SQLAlchemySchemaNode(Customer)
    schema = _customize_schema(schema)
    schema['name'].missing = colander.required
    schema.after_bind = _customer_after_bind
    return schema
Пример #5
0
def get_individual_customer_schema():
    """
    return the schema for user add/edit regarding the current user's role
    """
    excludes = ('name', 'tva_intracomm', 'function', 'registration')
    schema = SQLAlchemySchemaNode(Customer, excludes=excludes)
    schema = _customize_schema(schema)
    schema['firstname'].title = u"Prénom"
    schema['lastname'].title = u'Nom'
    schema['civilite'].missing = colander.required
    schema['lastname'].missing = colander.required
    schema.after_bind = _customer_after_bind
    return schema
Пример #6
0
def get_individual_customer_schema():
    """
    return the schema for user add/edit regarding the current user's role
    """
    excludes = ('name', 'tva_intracomm', 'function', 'registration')
    schema = SQLAlchemySchemaNode(Customer, excludes=excludes)
    schema = _customize_schema(schema)
    schema['firstname'].title = u"Prénom"
    schema['lastname'].title = u'Nom'
    schema['civilite'].missing = colander.required
    schema['lastname'].missing = colander.required
    schema.after_bind = _customer_after_bind
    return schema