Exemplo n.º 1
0
    def __init__(self, view=None, loadFromType=None, context=None, request=None, app=None, **kw):
        ObjectForm.__init__(self, view=view, loadFromType=loadFromType)
        
        self.actions = [
            Conf(id="default",    method="StartForm", name=_(u"Initialize"),    hidden=True),
            Conf(id="defaultEdit",method="LoadUser",  name=_(u"Initialize"),    hidden=True),
            Conf(id="create",     method="AddUser",   name=_(u"Signup"),        hidden=False, options={"renderSuccess":False}),
            Conf(id="edit",       method="Update",    name=_(u"Confirm"),       hidden=False),
            Conf(id="mailpass",   method="MailPass",  name=_(u"Mail password"), hidden=False),
            Conf(id="resetpass",  method="ResetPass", name=_(u"Reset password"), hidden=False),
            Conf(id="login",      method="Login",     name=_(u"Login"),         hidden=False),
        ]
    
        self.subsets = {
            "create": {"fields":  ["name", "password", "email", "surname", "lastname"], 
                       "actions": ["create"],
                       "defaultAction": "default"},
            "create2":{"fields":  ["name", "email"], 
                       "actions": ["create"],
                       "defaultAction": "default"},
            "edit":   {"fields":  ["email", 
                                   FieldConf(id="password", name=_("Password"), datatype="password", required=False, settings={"update": True}),
                                   "surname", "lastname"], 
                       "actions": ["defaultEdit", "edit"],
                       "defaultAction": "defaultEdit"},
            "login":  {"fields":  ["name", FieldConf(id="password", name=_("Password"), datatype="password", settings={"single": True})], 
                       "actions": ["login"],
                       "defaultAction": "default"},
            "mailpass":{"fields": ["email"], 
                        "actions": ["mailpass"],
                        "defaultAction": "default"},
            "resetpass":{"fields": ["email"], 
                        "actions": ["resetpass"],
                        "defaultAction": "default"},
        }

        self.activate = 1
        self.generatePW = 0
        self.notify = True
        self.mail = None
        self.mailpass = None
        self.groups = ""
        self.css_class = "smallform"
Exemplo n.º 2
0
    def __init__(self,
                 view=None,
                 loadFromType=None,
                 context=None,
                 request=None,
                 app=None,
                 **kw):
        ObjectForm.__init__(self, view=view, loadFromType=loadFromType)

        self.actions = [
            Conf(id="default",
                 method="StartForm",
                 name=_(u"Initialize"),
                 hidden=True),
            Conf(id="defaultEdit",
                 method="LoadUser",
                 name=_(u"Initialize"),
                 hidden=True),
            Conf(id="create",
                 method="AddUser",
                 name=_(u"Signup"),
                 hidden=False,
                 options={"renderSuccess": False}),
            Conf(id="edit", method="Update", name=_(u"Confirm"), hidden=False),
            Conf(id="mailpass",
                 method="MailPass",
                 name=_(u"Mail password"),
                 hidden=False),
            Conf(id="resetpass",
                 method="ResetPass",
                 name=_(u"Reset password"),
                 hidden=False),
            Conf(id="login", method="Login", name=_(u"Login"), hidden=False),
        ]

        self.subsets = {
            "create": {
                "fields": ["name", "password", "email", "surname", "lastname"],
                "actions": ["create"],
                "defaultAction": "default"
            },
            "create2": {
                "fields": ["name", "email"],
                "actions": ["create"],
                "defaultAction": "default"
            },
            "edit": {
                "fields": [
                    "email",
                    FieldConf(id="password",
                              name=_("Password"),
                              datatype="password",
                              required=False,
                              settings={"update": True}), "surname", "lastname"
                ],
                "actions": ["defaultEdit", "edit"],
                "defaultAction":
                "defaultEdit"
            },
            "login": {
                "fields": [
                    "name",
                    FieldConf(id="password",
                              name=_("Password"),
                              datatype="password",
                              settings={"single": True})
                ],
                "actions": ["login"],
                "defaultAction":
                "default"
            },
            "mailpass": {
                "fields": ["email"],
                "actions": ["mailpass"],
                "defaultAction": "default"
            },
            "resetpass": {
                "fields": ["email"],
                "actions": ["resetpass"],
                "defaultAction": "default"
            },
        }

        self.activate = 1
        self.generatePW = 0
        self.notify = True
        self.mail = None
        self.mailpass = None
        self.groups = ""
        self.css_class = "smallform"
Exemplo n.º 3
0
    def __init__(self, view=None, loadFromType=None, context=None, request=None, app=None, **kw):
        ObjectForm.__init__(self, view=view, loadFromType=loadFromType, context=context, request=request, app=app, **kw)

        self.actions = [
            Conf(id="default",    method="StartForm", name=u"Initialize",    hidden=True),
            Conf(id="defaultEdit",method="LoadUser",  name=u"Initialize",    hidden=True),
            Conf(id="create",     method="AddUser",   name=_(u"Signup"),        hidden=False),
            Conf(id="edit",       method="Update",    name=_(u"Confirm"),       hidden=False),
            Conf(id="login",      method="Login",     name=_(u"Login"),         hidden=False),
        ]

        self.subsets = {
            "create": {
                # loads fields from user configuration
                "actions": ["create"],
                "defaultAction": "default"
            },
            "edit":   {
                # loads fields from user configuration
                "actions": ["edit"],
                "defaultAction": "defaultEdit"
            },

            "login":  {
                "fields":  [
                    FieldConf(id="name", name=_("Name"), datatype="string"),
                    FieldConf(id="password", name=_("Password"), datatype="password", settings={"single": True}),
                    FieldConf(id="redirect", datatype="string", size="500", name="redirect url", hidden=True),
                ],
                "actions": ["login"],
                "defaultAction": "default"
            },
            "loginMail":  {
                "fields":  [
                    FieldConf(id="name", name=_("Name or email"), datatype="string"),
                    FieldConf(id="password", name=_("Password"), datatype="password", settings={"single": True}),
                    FieldConf(id="redirect", datatype="string", size="500", name="redirect url", hidden=True),
                ],
                "actions": ["login"],
                "defaultAction": "default"
            },

            "activate": {
                "fields": [FieldConf(id="token", datatype="string", size="500", name="Activation token", required=True, hidden=False)],
                "actions": [Conf(id="activate", method="Activate", name=_(u"Activate"), hidden=False)],
                "defaultAction": "activate"
            },
            "updatepass":{
                "fields": [
                    FieldConf(id="oldpassword",
                              datatype="password",
                              size=100,
                              default=u"",
                              required=1,
                              name=_(u"Old password"),
                              settings={"single":True},
                              validator=OldPwValidator),
                    "password"
                ],
                "actions": [Conf(id="updatepass", method="UpdatePass", name=_(u"Update password"), hidden=False)],
                "defaultAction": "default"
            },

            "updatemail1": {
                "fields": [
                    FieldConf(id="newmail",
                           datatype="email",
                           size=255,
                           default=u"",
                           required=1,
                           name=_(u"New email"),
                           validator=EmailValidator)
                ],
                "actions": [Conf(id="updatemail", method="UpdateMail", name=_(u"Update email"), hidden=False)],
                "defaultAction": "default"
            },
            "updatemail2": {
                "fields": [FieldConf(id="token", datatype="string", size="500", name="Activation token", required=True, hidden=False)],
                "actions": [Conf(id="updatemail_token", method="UpdateMailToken", name=_(u"Verify email"), hidden=False)],
                "defaultAction": "updatemail_token"
            },

            "resetpass": {
                "fields": [FieldConf(id="name", name=_("Name"), datatype="string")],
                "actions": [Conf(id="resetpass", method="ResetPass", name=_(u"Reset password"), hidden=False)],
                "defaultAction": "default"
            },
            "resetpassMail": {
                "fields": [FieldConf(id="name", name=_("Email"), datatype="string")],
                "actions": [Conf(id="resetpass", method="ResetPass", name=_(u"Reset password"), hidden=False)],
                "defaultAction": "default"
            },
            "contact": {
                "fields": [FieldConf(id="message", name=_("Message"), datatype="text", required=True, size=3000)],
                "actions": [Conf(id="contact", method="Contact", name=_(u"Send message"), hidden=False)],
                "defaultAction": Conf(id="default", method="StartRequestPOST", name=_(u"Initialize"), hidden=True)
            },
        }

        self.css_class = "smallform"
        self.settings = {}