Beispiel #1
0
    def valid(self, f):
        p1 = f.get('password', None)
        p2 = f.get('password2', None)
        if not p1 and not p2:
            return True
        elif p1 and p2 and p1 == p2:
            self.msg = _("Password length must be between 6-20")
            return bool(re.compile(".{6,20}").match(f.password))

        self.msg = _("Password didn't match")
        return False
Beispiel #2
0
from rinjani.string import dummy_translate as _

admin = (_('Dashboard'), [
    ('/dashboard', 'dashboard'),
    ('/admin/users', _('users')),
    ('/admin/verifications', _('verifications')),
    ('/admin/reports', _('reports')),
])

profile = ('%(fullname)s', [
    ('/profile/%(username)s', _('wall')),
    ('/profile/%(username)s/about', _('about')),
    ('/profile/%(username)s/donations', _('donations'), {
        'private': True
    }),
    ('/profile/%(username)s/articles', _('articles')),
    ('/profile/%(username)s/projects', _('projects')),
])

new_public = ('New', [('/article/new', _('article'))])

new_agent = new_sponsor = ('New', [
    ('/article/new', _('article')),
    ('/project/new', _('project')),
])

new_admin = (_('New'), [
    ('/article/new', _('article')),
    ('/project/new', _('project')),
    ('/page/new', _('page')),
])
Beispiel #3
0
from rinjani.string import dummy_translate as _

admin = (
    _("Dashboard"),
    [
        ("/dashboard", "dashboard"),
        ("/admin/users", _("users")),
        ("/admin/verifications", _("verifications")),
        ("/admin/reports", _("reports")),
    ],
)

profile = (
    "%(fullname)s",
    [
        ("/profile/%(username)s", _("wall")),
        ("/profile/%(username)s/about", _("about")),
        ("/profile/%(username)s/donations", _("donations"), {"private": True}),
        ("/profile/%(username)s/articles", _("articles")),
        ("/profile/%(username)s/projects", _("projects")),
    ],
)

new_public = ("New", [("/article/new", _("article"))])

new_agent = new_sponsor = ("New", [("/article/new", _("article")), ("/project/new", _("project"))])

new_admin = (_("New"), [("/article/new", _("article")), ("/project/new", _("project")), ("/page/new", _("page"))])

articles = (
    "Articles",
Beispiel #4
0
 def rendernote(self, note):
     if note: return '<span class="invalid">%s</span>' % _(note)
     else: return ""
Beispiel #5
0
    def render_css(self):
        out = []
        out.append(self.rendernote(self.note))
        for i in self.inputs:
            try:
                if i.pre_separator:
                    out.append('<hr /')
            except: pass

            out.append('<div class="i">')
            
            if isinstance(i, Checkbox):
                out.append('<label for="%s">%s <span class="cb-label">%s</span> %s</label>' % (i.id, i.render(), _(i.description), i.rendernote(i.note)))
            else:
                out.append('<label for="%s">%s %s</label>' % (i.id, __(i.description), i.rendernote(i.note)))
                out.append(i.render())
            #out.append(i.rendernote(i.note))
            out.append('</div>')
            out.append('\n')
        return ''.join(out)
Beispiel #6
0
 def __init__(self, len):
     self.len = len
     self.msg = _("Maximum %d chars") % len
Beispiel #7
0
class PassValidator(form.Validator):
    def __init__(self): pass

    def valid(self, f):
        p1 = f.get('password', None)
        p2 = f.get('password2', None)
        if not p1 and not p2:
            return True
        elif p1 and p2 and p1 == p2:
            self.msg = _("Password length must be between 6-20")
            return bool(re.compile(".{6,20}").match(f.password))

        self.msg = _("Password didn't match")
        return False

vusername = form.regexp(r"[a-z0-9]{4,9}", _("4-9 characters of alphabets and numbers, without space"))
vpass = form.regexp(r".{6,20}", _('Must be between 6 and 20 characters'))
vemail = form.regexp(r".*@.*", _("Must be a valid email address"))

api_request_form = MyForm(
    Textbox("email", form.notnull, vemail, description=_("Your email")),
    Textbox("fullname", form.notnull, description=_("Your full name")),
    Textbox("website", description=_("Your website")),
    Textarea("about", rows=3, cols=39, description=_("What are you planning to make?")),
)

register_form = MyForm(
    Textbox("username", form.notnull, vusername, description=_("User Name"), title=_("4-9 characters of alphabets and numbers, without space")),
    Password("password", form.notnull, vpass, description=_("Password")),
    Password("password2", form.notnull, description=_("Repeat password"), title=_("Repeat password")),
    Dropdown(name='type', args=USERTYPE, description=_('I am a')),