Beispiel #1
0
class ILoginForm(interface.Interface):
    login = schema.TextLine(title=_(u"Username"))
    password = schema.Password(title=_(u"Password"))
class IMailSchema(Interface):

    smtp_host = schema.TextLine(
        title=_(
            u'label_smtp_server',
            default=u'SMTP server'),
        description=_(
            u"help_smtp_server",
            default=u"The address of your local "
                    u"SMTP (outgoing e-mail) server. Usually "
                    u"'localhost', unless you use an "
                    u"external server to send e-mail."),
        default=u'localhost',
        required=True)

    smtp_port = schema.Int(
        title=_(u'label_smtp_port',
                default=u'SMTP port'),
        description=_(u"help_smtp_port",
                      default=u"The port of your local SMTP "
                              u"(outgoing e-mail) server. Usually '25'."),
        default=25,
        required=True)

    smtp_userid = schema.TextLine(
        title=_(
            u'label_smtp_userid',
            default=u'ESMTP username'),
        description=_(
            u"help_smtp_userid",
            default=u"Username for authentication "
                    u"to your e-mail server. Not required "
                    u"unless you are using ESMTP."),
        default=None,
        required=False)

    smtp_pass = schema.Password(
        title=_(
            u'label_smtp_pass',
            default=u'ESMTP password'),
        description=_(
            u"help_smtp_pass",
            default=u"The password for the ESMTP "
                    u"user account."),
        default=None,
        required=False)

    email_from_name = schema.TextLine(
        title=_(u"Site 'From' name"),
        description=_(
            u"Plone generates e-mail using "
            u"this name as the e-mail "
            u"sender."),
        default=None,
        required=True)

    email_from_address = schema.ASCIILine(
        title=_(u"Site 'From' address"),
        description=_(
            u"Plone generates e-mail using "
            u"this address as the e-mail "
            u"return address. It is also "
            u"used as the destination "
            u"address for the site-wide "
            u"contact form and the 'Send test "
            u"e-mail' feature."),
        default=None,
        required=True)
Beispiel #3
0
class IMAXUISettings(form.Schema):
    """Global oAuth settings. This describes records stored in the
    configuration registry and obtainable via plone.registry.
    """

    form.mode(oauth_server='hidden')
    oauth_server = schema.TextLine(
        title=_(u'label_oauth_server', default=u'OAuth token endpoint'),
        description=_(
            u'help_oauth_server',
            default=u"Please, specify the URI for the oAuth server."),
        required=True,
        default=DEFAULT_OAUTH_TOKEN_ENDPOINT)

    max_server = schema.TextLine(
        title=_(u'label_max_server', default=u'MAX Server URL'),
        description=_(u'help_max_server',
                      default=u"Please, specify the MAX Server URL."),
        required=True,
        default=DEFAULT_MAX_SERVER)

    max_server_alias = schema.TextLine(
        title=_(
            u'label_max_server_alias',
            default=u'MAX Server URL Alias (Fallback when no CORS available)'),
        description=_(u'help_max_server_alias',
                      default=u"Please, specify the MAX Server URL Alias."),
        required=False,
        default=DEFAULT_MAX_SERVER)

    form.mode(max_restricted_username='******')
    max_restricted_username = schema.TextLine(
        title=_(u'label_max_restricted_username',
                default=u'MAX restricted username'),
        description=_(u'help_max_restricted_username',
                      default=u"Please, specify the MAX restricted username."),
        required=False,
        default=DEFAULT_MAX_RESTRICTED_USERNAME)

    form.mode(max_restricted_token='hidden')
    max_restricted_token = schema.Password(
        title=_(u'label_max_restricted_token',
                default=u'MAX restricted user token'),
        description=_(
            u'help_max_restricted_token',
            default=u"Please, specify the MAX restricted user token."),
        required=False,
    )

    hub_server = schema.TextLine(
        title=_(u'label_hub_server', default=u'uLearnHub server'),
        description=_(
            u'help_hub_server',
            default=u"Please, specify the uLearnHub server for this site."),
        required=False,
        default=DEFAULT_HUB_SERVER)

    domain = schema.TextLine(
        title=_(u'label_domain', default=u'MAX domain'),
        description=_(
            u'help_domain',
            default=u"Please, specify the HUB domain for this site."),
        required=False,
        default=DEFAULT_DOMAIN)
class ISettings(model.Schema):

    payment_processor = schema.Choice(
        title=u'Payment Processor',
        description=u"Important - Please make sure that the relevant API keys"
        u" for the selected payment processor are completed below.",
        vocabulary='jazkarta.shop.payment_processors',
    )

    stripe_api_key_dev = schema.TextLine(
        title=u'Stripe Secret Key (Development)',
        required=False,
    )

    stripe_pub_key_dev = schema.TextLine(
        title=u'Stripe Publishable Key (Development)',
        required=False,
    )

    stripe_api_key_production = schema.TextLine(
        title=u'Stripe Secret Key (Production)',
        description=u"This key will be used when the JAZKARTA_SHOP_ENV "
        u"environment variable equals 'production'.",
        required=False,
    )

    stripe_pub_key_production = schema.TextLine(
        title=u'Stripe Publishable Key (Production)',
        description=u"This key will be used when the JAZKARTA_SHOP_ENV "
        u"environment variable equals 'production'.",
        required=False,
    )

    authorizenet_api_login_id_dev = schema.TextLine(
        title=u'Authorize.Net API Login ID (Sandbox)',
        required=False,
    )

    authorizenet_transaction_key_dev = schema.TextLine(
        title=u'Authorize.Net Transaction Key (Sandbox)',
        required=False,
    )

    authorizenet_signature_key_dev = schema.TextLine(
        title=u'Authorize.Net Signature Key (Sandbox)',
        required=False,
    )

    authorizenet_api_login_id_production = schema.TextLine(
        title=u'Authorize.Net API Login ID (Production)',
        description=u"This key will be used when the JAZKARTA_SHOP_ENV "
        u"environment variable equals 'production'.",
        required=False,
    )

    authorizenet_transaction_key_production = schema.TextLine(
        title=u'Authorize.Net Transaction Key (Production)',
        description=u"This key will be used when the JAZKARTA_SHOP_ENV "
        u"environment variable equals 'production'.",
        required=False,
    )

    authorizenet_signature_key_production = schema.TextLine(
        title=u'Authorize.Net Signature Key (Production)',
        description=u"This key will be used when the JAZKARTA_SHOP_ENV "
        u"environment variable equals 'production'.",
        required=False,
    )

    authorizenet_sim_url_dev = schema.TextLine(
        title=u'Authorize.Net SIM URL (Sandbox)',
        required=False,
    )

    authorizenet_sim_url_production = schema.TextLine(
        title=u'Authorize.Net SIM URL (Production)',
        description=u"This key will be used when the JAZKARTA_SHOP_ENV "
        u"environment variable equals 'production'.",
        required=False,
    )

    authorizenet_sim_logo_url = schema.TextLine(
        title=u'Authorize.Net SIM Logo URL',
        description=u"Url path to (optional) logo hosted by Authorize.Net.",
        required=False,
    )

    authorizenet_client_key_dev = schema.TextLine(
        title=u'Authorize.Net Client Key (Sandbox)',
        required=False,
    )

    authorizenet_client_key_production = schema.TextLine(
        title=u'Authorize.Net Client Key (Production)',
        description=u"This key will be used when the JAZKARTA_SHOP_ENV "
        u"environment variable equals 'production'.",
        required=False,
    )

    receipt_subject = schema.TextLine(
        title=u'Subject for Receipt Email',
        default=u'Receipt for your purchase',
    )

    receipt_intro = schema.Text(
        title=u'Receipt Email Introduction',
        description=u'Text displayed at the top of the receipt email.',
    )

    product_categories = schema.List(
        title=u'Product Categories',
        value_type=schema.TextLine(),
        required=False,
        default=[],
    )

    min_stock_level = schema.Int(
        title=u'Minimum Stock Level',
        description=u'If merchandise stock is below this level, '
        u'the item will not be available for online purchase.',
        default=5,
        min=0,
    )

    ship_from_name = schema.TextLine(title=u'Ship From Name')
    ship_from_address = schema.TextLine(title=u'Ship From Address')
    ship_from_city = schema.TextLine(title=u'Ship From City')
    ship_from_state = schema.TextLine(title=u'Ship From State')
    ship_from_zip = schema.TextLine(title=u'Ship From Zip')
    ship_from_country = schema.Choice(
        title=u'Ship From Country',
        default=u'United States',
        vocabulary='jazkarta.shop.countries',
    )

    ups_username = schema.TextLine(title=u'ups.com Username')
    ups_password = schema.Password(
        title=u'ups.com Password',
        required=False,
    )
    ups_api_key = schema.TextLine(title=u'UPS API Key')
    ups_account = schema.TextLine(title=u'UPS Account Number')

    usps_userid = schema.TextLine(title=u'USPS WebTools API User Id')

    tax_handlers = schema.List(
        title=u'Calculate Tax Using',
        value_type=schema.Choice(vocabulary='jazkarta.shop.tax_handlers', ),
        default=[],
    )

    taxjar_smartcalcs_api_key = schema.TextLine(
        title=u'TaxJar SmartCalcs API Token',
        required=False,
    )

    after_checkout_callback_url = schema.TextLine(
        title=u'After checkout callback URL',
        description=u"If specified, users will be redirected "
        u"to this URL with an 'order_id' parameter, instead "
        u"of being shown the default 'Thank you' page.",
        required=False,
    )

    @invariant
    def validate_payment_processor_keys(data):
        if data.payment_processor == 'Authorize.Net SIM':
            if data.authorizenet_api_login_id_dev is None or \
                data.authorizenet_transaction_key_dev is None or \
                data.authorizenet_api_login_id_production is None or \
                data.authorizenet_transaction_key_production is None or \
                data.authorizenet_sim_url_production is None or \
                data.authorizenet_sim_url_dev is None:
                raise Invalid(u"Authorize.Net SIM API key data is missing.")
        elif data.payment_processor == 'Stripe':
            if data.stripe_api_key_dev is None or \
                data.stripe_pub_key_dev is None or \
                data.stripe_api_key_production is None or \
                data.stripe_pub_key_production is None:
                raise Invalid(u"Stripe API key data is missing.")
Beispiel #5
0
 class IPassRecoveryForm(interface.Interface):
     password = schema.Password(title=_(u"Password"),
                            required=True)
     retyped_password = schema.Password(title=_(u"Retype password"),
                            required=True)    
Beispiel #6
0
class IWS4PMClientSettings(Interface):
    """
    Configuration of the WS4PM Client
    """
    pm_url = schema.TextLine(
        title=_(u"PloneMeeting WSDL URL"),
        required=True,)
    pm_timeout = schema.Int(
        title=_(u"PloneMeeting connection timeout"),
        description=_(u"Enter the timeout while connecting to PloneMeeting. Do not set a too high timeout because it "
                      "will impact the load of the viewlet showing PM infos on a sent element if PM is not available. "
                      "Default is '10' seconds."),
        default=10,
        required=True,)
    pm_username = schema.TextLine(
        title=_("PloneMeeting username to use"),
        description=_(u"The user must be at least a 'MeetingManager'. Nevertheless, items will be created regarding "
                      "the <i>User ids mappings</i> defined here under."),
        required=True,)
    pm_password = schema.Password(
        title=_("PloneMeeting password to use"),
        required=True,)
    only_one_sending = schema.Bool(
        title=_("An element can be sent one time only"),
        default=True,
        required=True,)
    viewlet_display_condition = schema.TextLine(
        title=_("Viewlet display condition"),
        description=_("Enter a TAL expression that will be evaluated to check if the viewlet displaying "
                      "informations about the created items in PloneMeeting should be displayed. "
                      "If empty, the viewlet will only be displayed if an item is actually linked to it. "
                      "The 'isLinked' variable representing this default behaviour is available "
                      "in the TAL expression."),
        required=False,)
    field_mappings = schema.List(
        title=_("Field accessor mappings"),
        description=_("For every available data you can send, define in the mapping a TAL expression that will be "
                      "executed to obtain the correct value to send. The 'meetingConfigId' and 'proposingGroupId' "
                      "variables are also available for the expression. Special case for the 'proposingGroup' and "
                      "'category' fields, you can 'force' the use of a particular value by defining it here. If not "
                      "defined the user will be able to use every 'proposingGroup' or 'category' he is allowed to "
                      "use in PloneMeeting."),
        value_type=DictRow(title=_("Field mappings"),
                           schema=IFieldMappingsSchema,
                           required=False),
        required=False,)
    allowed_annexes_types = schema.List(
        title=_("Allowed annexes types"),
        description=_("List here the annexes types allowed to be display in the linked meeting item viewlet"),
        value_type=DictRow(title=_("Allowed annex type"),
                           schema=IAllowedAnnexTypesSchema,
                           required=False),
        default=[],
        required=False,)
    user_mappings = schema.List(
        title=_("User ids mappings"),
        description=_("By default, while sending an element to PloneMeeting, the user id of the logged in user "
                      "is used and a binding is made to the same user id in PloneMeeting. "
                      "If the local user id does not exist in PloneMeeting, you can define here the user mappings "
                      "to use. For example : 'jdoe' in 'Local user id' of the current application correspond to "
                      "'johndoe' in PloneMeeting."),
        value_type=DictRow(title=_("User mappings"),
                           schema=IUserMappingsSchema,
                           required=False),
        required=False,)
    generated_actions = schema.List(
        title=_("Generated actions"),
        description=_("Actions to send an item to PloneMeeting can be generated. First enter a 'TAL condition' "
                      "evaluated to show the action then choose permission(s) the user must have to see the action. "
                      "Finally, choose the meetingConfig the item will be sent to."),
        value_type=DictRow(title=_("Actions"),
                           schema=IGeneratedActionsSchema,
                           required=False),
        required=False,)
Beispiel #7
0
class ISettings(Interface):
    """
    Controlpanel fields.
    """

    fieldset(_(u'settings_fieldset_server', default=u'Server'),
             fields=[
                 'sync_to_ldap', 'ldap_server_uri', 'ldap_service_user',
                 'ldap_service_pass'
             ])

    sync_to_ldap = schema.Bool(
        title=_(u'settings_sync_to_ldap_title', default=u'LDAP Syncing'),
        description=_(
            u'settings_sync_to_ldap_description',
            default=
            u'If enabled, the CRM will attempt an LDAP connection on sync events.'
        ),  # noqa
        required=False,
        default=False,
    )

    ldap_server_uri = schema.TextLine(
        title=_(u'settings_ldap_server_uri_title', default=u'LDAP Server URI'),
        default=u'ldap://127.0.0.1',
        required=False,
    )

    ldap_service_user = schema.TextLine(
        title=_(u'settings_ldap_service_user_title',
                default=u'LDAP Service User'),
        required=False,
        default=u'cn=admin,dc=example,dc=com',
    )

    ldap_service_pass = schema.Password(
        title=_(u'settings_ldap_service_pass_title',
                default=u'LDAP Service Password'),
        required=False,
    )

    fieldset(_(u'settings_fieldset_dn', default=u'DN'),
             fields=['users_dn', 'groups_dn', 'accounts_dn', 'archives_dn'])

    users_dn = schema.TextLine(
        title=_(u'settings_users_dn_title', default=u'Users DN'),
        description=_(
            u'settings_users_dn_description',
            default=u'Include the users DN. e.g. ou=users,dc=example,dc=com'
        ),  # noqa
        required=False,
        default=u'ou=users,dc=example,dc=com',
    )

    groups_dn = schema.TextLine(
        title=_(u'settings_groups_dn_title', default=u'Groups DN'),
        description=_(
            u'settings_groups_dn_description',
            default=u'Include the groups DN. e.g. ou=groups,dc=example,dc=com'
        ),  # noqa
        required=False,
        default=u'ou=groups,dc=example,dc=com',
    )

    accounts_dn = schema.TextLine(
        title=_(u'settings_accounts_dn_title', default=u'Accounts DN'),
        description=_(
            u'settings_accounts_dn_description',
            default=
            u'Include the accounts DN. e.g. ou=accounts,dc=example,dc=com'
        ),  # noqa
        required=False,
        default=u'ou=accounts,dc=example,dc=com',
    )

    archives_dn = schema.TextLine(
        title=_(u'settings_archives_dn_title', default=u'Archives DN'),
        description=_(
            u'settings_archives_dn_description',
            default=
            u'Include the archives DN. e.g. ou=archives,dc=example,dc=com'
        ),  # noqa
        required=False,
        default=u'ou=archives,dc=example,dc=com',
    )

    fieldset(_(u'settings_fieldset_mapping', default=u'Mapping'),
             fields=[
                 'ldap_field_mapping_contact', 'ldap_field_mapping_account',
                 'ldap_objectclass_mapping'
             ])

    ldap_field_mapping_contact = schema.List(
        title=_(u'settings_ldap_field_mapping_contact_title',
                default=u'Contact Attribute Mapping'),
        description=_(
            u'settings_ldap_field_mapping_contact_description',
            default=
            u'Map Plone fields to their corresponding LDAP attributes. Plone|LDAP'
        ),  # noqa
        value_type=schema.TextLine(),
        default=[
            'title|cn', 'email|mail', 'firstname|givenname', 'lastname|sn'
        ],
        required=False,
    )

    ldap_field_mapping_account = schema.List(
        title=_(u'settings_ldap_field_mapping_account_title',
                default=u'Account Attribute Mapping'),
        description=_(
            u'settings_ldap_field_mapping_account_description',
            default=
            u'Map Plone fields to their corresponding LDAP attributes. Plone|LDAP'
        ),  # noqa
        value_type=schema.TextLine(),
        default=['title|cn', 'billing_email|mail', 'ceo|givenname', 'type|sn'],
        required=False,
    )

    ldap_objectclass_mapping = schema.List(
        title=_(u'settings_ldap_objectclass_mapping_title',
                default=u'Content-Type to objectClass Mapping'),
        description=_(
            u'settings_ldap_objectclass_mapping_description',
            default=u'Map Plone Content-Type to an LDAP objectClass. Plone|LDAP'
        ),  # noqa
        value_type=schema.TextLine(),
        default=[
            'Group|posixGroup', 'Account|inetOrgPerson',
            'Contact|inetOrgPerson'
        ],
        required=False,
    )

    fieldset(_(u'settings_fieldset_other', default=u'Other'),
             fields=['manual_ldap_actions', 'ldap_archiving'])

    manual_ldap_actions = schema.Bool(
        title=_(u'settings_manual_ldap_actions_title',
                default=u'Manual LDAP Actions'),
        description=_(
            u'settings_manual_ldap_actions_description',
            default=u'Enable manual LDAP controls in the actions menu.'
        ),  # noqa
        required=False,
        default=False,
    )

    ldap_archiving = schema.Bool(
        title=_(u'settings_ldap_archiving_title', default=u'LDAP Archiving'),
        description=_(
            u'settings_ldap_archiving_description',
            default=
            u'If enabled, duplicate LDAP entries will be archived instead of deleted.'
        ),  # noqa
        required=False,
        default=False,
    )
class IRequestSchema(form.Schema):
    """ This extends plone.app.users.userdataschema.IRegisterSchema and makes
        it available to dexterity, so we can create objects with this schema.
    """
    fullname = schema.TextLine(
        title=_(u'label_full_name', default=u'Full Name'),
        description=_(u'help_full_name_creation',
                      default=u"Enter full name, e.g. John Smith."),
        required=True)

    email = schema.ASCIILine(title=_(u'label_email', default=u'E-mail'),
                             description=u'',
                             required=True)

    organisation = schema.TextLine(
        title=_(u'label_organisation', default=u'Organisation'),
        description=_(u'help_organisation_creation',
                      default=u"Enter the name of your organisation."),
        required=True)

    sector = schema.Choice(vocabulary=u'slc.accountrequest.sector',
                           title=_(u'label_sector', default=u'Sector'),
                           description=_(
                               u'help_sector_creation',
                               default=u"Select the relevant NACE code."),
                           required=True)

    country_manager = schema.Bool(
        title=_(u'label_country_manager',
                default=u'Country Manager account required'),
        description=_(
            u'help_country_manager_creation',
            default=u"Tick if you require a country manager account."),
        required=False)

    receive_statistics = schema.Bool(
        title=_(u'label_receive_statistics', default=u'Receive statistics'),
        description=_(u'help_receive_statistics_creation',
                      default=u"Tick if you want to receive statistics."),
        required=False)

    username = schema.ASCIILine(
        title=_(u'label_user_name', default=u'User Name'),
        description=_(u'help_user_name_creation_casesensitive',
                      default=u"Enter a user name, usually something "
                      "like 'jsmith'. "
                      "No spaces or special characters. "
                      "Usernames and passwords are case sensitive, "
                      "make sure the caps lock key is not enabled. "
                      "This is the name used to log in."))

    password = schema.Password(title=_(u'label_password', default=u'Password'),
                               description=_(u'help_password_creation',
                                             default=u'Minimum 5 characters.'))

    password_ctl = schema.Password(
        title=_(u'label_confirm_password', default=u'Confirm password'),
        description=_(u'help_confirm_password',
                      default=u"Re-enter the password. "
                      "Make sure the passwords are identical."))

    form.widget(sector=TreeFieldWidget)

    @invariant
    def validatePassword(data):
        if data.password != data.password_ctl:
            raise PasswordsDoNotMatch(
                _(u"Password confirmation should match password."))
Beispiel #9
0
class IPageTurnerSettings(Interface):
    width = schema.Int(title=_(u'label_width_title_pageturner',
                               default=u"Width"),
                       description=_(
                           u"label_width_description_pageturn",
                           default=u"The fixed width of the Page Viewer."),
                       default=None,
                       required=False)

    height = schema.Int(title=_(u'label_height_title_pageturner',
                                default=u"Height"),
                        description=_(
                            u"label_height_description_pageturner",
                            default=u"The fixed height of the Page Viewer."),
                        default=None,
                        required=False)

    progressive_loading = schema.Bool(
        title=_(u'label_progressive_loading_pageturner',
                default=u'Progressive Loading'),
        description=_(u'label_progressive_loading_description_pageturner',
                      default=u'Progressively load the PDF. '
                      u'Essential for very large PDF files.'),
        default=None,
        required=False)

    print_enabled = schema.Bool(
        title=_(u'label_print_enabled_pageturner', default=u'Print Enabled'),
        description=_(u'label_print_enabled_description_pageturner',
                      default=u'Printer button enabled.'),
        default=None,
        required=False)

    fit_width_on_load = schema.Bool(
        title=_(u'label_fit_width_on_load_pageturner', default=u'Fit width'),
        description=_(u'label_fit_width_on_load_description_pageturner',
                      default=u'Should the pages fit the width.'),
        default=None,
        required=False)

    full_screen_visible = schema.Bool(
        title=_(u'label_full_screen_visible_pageturner',
                default=u'Full Screen Visible'),
        description=_(u'label_full_screen_visible_description_pageturner',
                      default=u'Full screen button visible.'),
        default=None,
        required=False)

    search_tools_visible = schema.Bool(
        title=_(u'label_search_tools_visible_pageturner',
                default=u'Search Tools Visible'),
        description=_(u'label_search_tools_visible_description_pageturner',
                      default=u'Search tools button visible.'),
        default=None,
        required=False)

    cursor_tools_visible = schema.Bool(
        title=_(u'label_cursor_tools_visible_pageturner',
                default=u'Cursor Tools Visible'),
        description=_(u'label_cursor_tools_visible_description_pageturner',
                      default=u'Cursor tools button visible.'),
        default=None,
        required=False)

    command_line_options = schema.TextLine(
        title=_(u'label_command_line_options_pageturner',
                default=u'Command Line Options'),
        description=_(
            u'description_command_line_options_pageturner',
            default=u'It is possible that you need to provide extra options '
            u'if there are errors while converting the PDF. '
            u'This should be a comma seperated list of '
            u'values(example "bitmap,bitmapfonts").'
            u"""Some known helpful options are "poly2bitmap" """
            u"""for bitmap errors and "bitmapfonts" """
            u"""for bitmap font errors."""),
        default=None,
        required=False)

    encryption_password = schema.Password(
        title=_(u'label_password_pageturner', default=u'Encryption Password'),
        description=_(u'description_password_pageturner',
                      default=u'Enter a password if your pdf is encrypted.'),
        default=u'',
        required=False)
Beispiel #10
0
class AccountDeleteSchema(model.Schema):
    password = schema.Password(title=_("Your password for confirmation"),
                               required=True)
    directives.widget(password="******")
Beispiel #11
0
class ILoginForm(interface.Interface):
    login = schema.TextLine(title=_("label_login_form_username",
        default=u"Username"))
    password = schema.Password(title=_("label_login_form_password", 
        default=u"Password"))
    camefrom = schema.TextLine(required=False)
Beispiel #12
0
class IResetPasswordForm(interface.Interface):
    password = schema.Password(title=_(u"Password"))
    confirm_password = schema.Password(title=_(u"Confirm Password"))
    key = schema.TextLine(required=False)
Beispiel #13
0
class IPasswordReset(model.Schema):
    login = schema.TextLine(title=_("label_login", default="Login"),
                            required=True)

    password = schema.Password(title=_("label_password", default="Password"),
                               required=True)
Beispiel #14
0
class IChangePasswordForm(interface.Interface):
    pswd = schema.Password(title=_(u"Password"), required=True)
    confirm_password = schema.Password(title=_(u"Confirm password"),
                                       required=True)
class IEnhancedUserDataSchema(Interface):
    """ Use all the fields from the default user data schema, and add various
    extra fields.
    """
    form.fieldset('login',
                  label=_(u"Login"),
                  fields=['username', 'password', 'password_ctl'])

    username = schema.ASCIILine(
        title=_(u'label_user_name', default=u'User Name'),
        description=_(u'help_user_name_creation_casesensitive',
                      default=u"Enter a user name, usually something "
                      "like 'jsmith'. "
                      "No spaces or special characters. "
                      "Usernames and passwords are case sensitive, "
                      "make sure the caps lock key is not enabled. "
                      "This is the name used to log in."))

    password = schema.Password(title=_(u'label_password', default=u'Password'),
                               description=_(
                                   u'help_password_creation',
                                   default=u'Enter your new password.'))

    password_ctl = schema.Password(
        title=_(u'label_confirm_password', default=u'Confirm password'),
        description=_(u'help_confirm_password',
                      default=u"Re-enter the password. "
                      "Make sure the passwords are identical."))

    @invariant
    def passwordsMatch(data):
        if data.password == data.password_ctl:
            return True
        raise PasswordPairInvalid

    form.fieldset(
        'personalinfo',
        label=_(u"Personal Info"),
        fields=['fullname', 'email', 'home_page', 'location', 'phone'])

    fullname = schema.TextLine(
        title=_(u'label_full_name', default=u'Full Name'),
        description=_(u'help_full_name_creation',
                      default=u"Enter full name, e.g. John Smith."),
        required=False)

    email = schema.ASCIILine(title=_(u'label_email', default=u'E-mail'),
                             description=u'',
                             required=True,
                             constraint=checkEmailAddress)

    home_page = schema.TextLine(
        title=_(u'label_homepage', default=u'Home page'),
        description=_(u'help_homepage',
                      default=u"The URL for your external home page, "
                      "if you have one."),
        required=False)

    location = schema.TextLine(title=_(u'label_location', default=u'Location'),
                               description=_(
                                   u'help_location',
                                   default=u"Your location - either city and "
                                   "country - or in a company setting, where "
                                   "your office is located."),
                               required=False)

    phone = schema.TextLine(
        title=_(u'label_phone', default=u'Telephone number'),
        description=_(u'help_phone',
                      default=u"Leave your phone number so we can reach you."),
        required=False,
    )

    form.fieldset('address',
                  label=_(u"Address"),
                  fields=['street', 'city', 'country'])
    street = schema.TextLine(
        title=_(u'label_street', default=u'Street'),
        description=_(u'help_street',
                      default=u"Fill in the street and number."),
        required=False,
    )

    city = schema.TextLine(
        title=_(u'label_city', default=u'City'),
        description=_(u'help_city', default=u"Fill in the city you live in."),
        required=False,
    )

    country = schema.TextLine(
        title=_(u'label_country', default=u'Country'),
        description=_(u'help_country',
                      default=u"Fill in the country you live in."),
        required=False,
    )
    form.fieldset('producent', label=_(u"Producent"), fields=[
        'producent',
    ])

    # form.fieldset(
    #     'producent_info',
    #     label = _(u"Producent's Info"),
    #     fields = ['new_producent',
    #               'producent',
    #               'producent_title',
    #               'producent_home_page',
    #               'producent_location',
    #               'producent_contact',
    #               'producent_agreement',]
    #     )
    # form.fieldset(
    #     'producent_address',
    #     label = _(u"Producent's Address"),
    #     fields = [  'producent_street',
    #                 'producent_city',
    #                 'producent_country',
    #                 ]
    #     )
    # new_producent = schema.Bool(
    #     title=_(u'label_new_producent', default=u'New producent'),
    #     description=_(u'help_new_producent',
    #                   default=u"Do you wan to create new producent?"),
    #     required=False,
    #     )

    #form.widget(producent=AutocompleteFieldWidget)
    producent = schema.Choice(
        title=_(u'label_producent', default=u'Producent'),
        description=_(u'help_producent',
                      default=u"Fill in the producent you work for."),
        required=False,
        source=producent_source,
    )