コード例 #1
0
class SetPasswordSchema(colander.MappingSchema):
    """
    Schema for the set password form
    """

    #: colander.String
    password = colander.SchemaNode(
        colander.String(),
        title=_('Password'),
        validator=colander.Length(min=5),
        widget=CheckedPasswordWidget(),
    )
    #: colander.String
    token = colander.SchemaNode(
        colander.String(),
        widget=HiddenWidget(),
    )
    #: colander.String
    email = colander.SchemaNode(
        colander.String(),
        title=_('Email'),
        widget=HiddenWidget(),
    )
    #: colander.String
    continue_to = colander.SchemaNode(
        colander.String(),
        widget=HiddenWidget(),
        missing=colander.null,
    )
コード例 #2
0
ファイル: users.py プロジェクト: rkx-forks/Kotti
class PrincipalFull(PrincipalBasic):
    name = colander.SchemaNode(
        colander.String(),
        title=_("Name"),
        validator=colander.All(name_pattern_validator, name_new_validator),
    )
    password = colander.SchemaNode(
        colander.String(),
        title=_("Password"),
        validator=colander.Length(min=5),
        missing=None,
        widget=CheckedPasswordWidget(),
    )
    active = colander.SchemaNode(
        colander.Boolean(),
        title=_("Active"),
        description=_("Untick this to deactivate the account."),
    )
    roles = colander.SchemaNode(
        colander.Set(),
        validator=roleset_validator,
        missing=[],
        title=_("Global roles"),
        widget=CheckboxChoiceWidget(),
    )
    groups = Groups(
        title=_("Groups"),
        missing=[],
        # XXX min_len doesn't really do what we want here.  We'd like
        # the close buttons to appear nevertheless (maybe the now
        # deprecated render_initial_item did exactly that).
        widget=SequenceWidget(min_len=1),
    )
コード例 #3
0
class UserForm(colander.MappingSchema):
    group = colander.SchemaNode(colander.String(encoding='utf-8'),
                                title=_(u"Role"),
                                widget=user_role_widget)

    clinics = colander.SchemaNode(colander.Set(),
                                  title=_(u"Clinic"),
                                  missing='',
                                  widget=clinic_selection_widget)

    municipality = colander.SchemaNode(colander.String(encoding='utf-8'),
                                       title=_(u"Municipality"),
                                       missing='',
                                       widget=municipality_selection_widget)

    state = colander.SchemaNode(colander.String(encoding='utf-8'),
                                title=_(u"State"),
                                missing='',
                                widget=state_selection_widget)

    password = colander.SchemaNode(colander.String(encoding='utf-8'),
                                   validator=colander.Length(min=5),
                                   widget=CheckedPasswordWidget(),
                                   missing='',
                                   title=_(u"Change Password"))

    def validator(self, node, value):
        exc = colander.Invalid(node, "")
        valid = True
        if value['group'] not in GROUPS:
            valid = False
        if not valid:
            raise exc
コード例 #4
0
class EditAccount(Schema):
    login_name = SchemaNode(
        String(),
        validator=login_name_validator,
    )
    email = SchemaNode(String(), validator=Email())
    old_password = SchemaNode(
        String(),
        widget=old_password_widget,
        missing=old_password_missing,
        validator=old_password_validator,
    )
    password = SchemaNode(String(), widget=CheckedPasswordWidget())
    security = SecurityQuestion()
コード例 #5
0
class SetPasswordSchema(colander.MappingSchema):
    password = colander.SchemaNode(
        colander.String(),
        title=_(u'Password'),
        validator=colander.Length(min=5),
        widget=CheckedPasswordWidget(),
    )
    token = colander.SchemaNode(
        colander.String(),
        widget=HiddenWidget(),
    )
    email = colander.SchemaNode(
        colander.String(),
        title=_(u'Email'),
        widget=HiddenWidget(),
    )
    continue_to = colander.SchemaNode(
        colander.String(),
        widget=HiddenWidget(),
        missing=colander.null,
    )
コード例 #6
0
class RegistrationForm(colander.MappingSchema):
    group = colander.SchemaNode(colander.String(encoding='utf-8'),
                                title=_(u"Role"),
                                widget=new_user_role_widget)
    clinics = colander.SchemaNode(colander.Set(),
                                  title=_(u"Clinic"),
                                  missing='',
                                  widget=clinic_selection_widget)
    municipality = colander.SchemaNode(colander.String(encoding='utf-8'),
                                       title=_(u"Municipality"),
                                       missing='',
                                       widget=municipality_selection_widget)
    state = colander.SchemaNode(colander.String(encoding='utf-8'),
                                title=_(u"State"),
                                missing='',
                                widget=state_selection_widget)
    username = colander.SchemaNode(
        colander.String(encoding='utf-8'),
        validator=colander.Length(max=25,
                                  max_err=_(u'Longer than maximum length 25')),
        widget=TextInputWidget(),
        title=_(u"Username"),
        description=_(u"Type the username of the clinic"))
    password = colander.SchemaNode(
        colander.String(encoding='utf-8'),
        validator=colander.Length(min=5,
                                  min_err=_(u'Shorter than minimum length 5')),
        widget=CheckedPasswordWidget(subject=_(u"Password"),
                                     confirm_subject=_(u"Confirm Password")),
        title=_(u"Password"))

    def validator(self, node, value):
        exc = colander.Invalid(node, "")
        valid = True
        if value['group'] not in GROUPS:
            valid = False

        if not valid:
            raise exc
コード例 #7
0
class Join(CSRFSchema):
    handle = SchemaNode(String(), title=u'ハンドル')
    password = SchemaNode(String(),
                          title=u'パスワード',
                          widget=CheckedPasswordWidget())