Exemple #1
0
    def GET(self):
        web.header('Content-Type', 'text/plain')
        if 'id' not in web.input():
            return "false"

        if check_id(web.input().id) == False:
            return "false"
        
        u = web.config.db.select('users', dict(u=web.input().id), where="id=$u", what="id").list()
        if len(u) is 0:
            return "true"
        else:
            return "false"
Exemple #2
0
    def GET(self):
        web.header('Content-Type', 'text/plain')
        if 'id' not in web.input():
            return "false"

        if check_id(web.input().id) == False:
            return "false"

        u = web.config.db.select('users',
                                 dict(u=web.input().id),
                                 where="id=$u",
                                 what="id").list()
        if len(u) is 0:
            return "true"
        else:
            return "false"
Exemple #3
0
import web
from sqlite3 import IntegrityError
from web import form
from util import make_id_string, check_id
from common import *
from decorators import requires_login, requires_group_admin

group_register_form = form.Form(
    form.Textbox("name", description="Group name"),
    form.Textbox("id", description="Identifier"),
    form.Textarea("desc", description="Description"),
    form.Radio("joinable", ["yes", "no"], description="Joinable"),
    validators=[
        form.Validator("Invalid characters in ID",
                       lambda i: i.id == make_id_string(i.id)),
        form.Validator("Invalid ID (keyword clash)", lambda i: check_id(i.id)),
        form.Validator("ID too short", lambda i: len(i.id) > 3)
    ])


class create:
    @requires_login
    def GET(self):
        web.header('Content-Type', 'text/html')
        f = group_register_form()
        return render.createGroup(form=f)

    @requires_login
    def POST(self):
        web.header('Content-Type', 'text/html')
        f = group_register_form()
Exemple #4
0
import time
import web
from sqlite3 import IntegrityError
from web import form
from util import make_id_string, check_id
from common import *
from decorators import requires_login, requires_group_admin

group_register_form = form.Form(
    form.Textbox("name", description="Group name"),
    form.Textbox("id", description="Identifier"),
    form.Textarea("desc", description="Description"),
    form.Radio("joinable", ["yes", "no"], description="Joinable"),
    validators = [
        form.Validator("Invalid characters in ID", lambda i: i.id == make_id_string(i.id)),
        form.Validator("Invalid ID (keyword clash)", lambda i: check_id(i.id)),
        form.Validator("ID too short", lambda i: len(i.id) > 3)])

class create:
    @requires_login
    def GET(self):
        web.header('Content-Type', 'text/html')
        f = group_register_form()
        return render.createGroup(form=f)

    @requires_login
    def POST(self):
        web.header('Content-Type', 'text/html')
        f = group_register_form()
        if not f.validates():
            return render.createGroup(form=f)
Exemple #5
0
from util import make_id_string, check_id

vpass = form.regexp(r".{3,}$", 'must be at least 3 characters long')
vemail = form.regexp(r".*@.*", "must be a valid email address")

register_form = form.Form(
    form.Textbox("name", id="form_name", description="Name"),
    form.Textbox("id", id="form_id", description="Identifier"), 
    form.Textbox("email", vemail, description="Email"),
    form.Password("password", vpass, description="Password"),
    form.Password("password2", description="Repeat password"),
    form.Button("submit", type="submit", description="Register"),
    validators = [
        form.Validator("Passwords did't match", lambda i: i.password == i.password2),
        form.Validator("Invalid Identifier", lambda i: i.id == make_id_string(i.id)),
        form.Validator("Invalid Identifier (uses keywords)", lambda i: check_id(i.id))])

ldap_register_form = form.Form(
    form.Textbox("username", description="Username"),
    form.Textbox("fullname", description="Name"),
    form.Textbox("id", description="Identifier"), 
    form.Button("submit", type="submit", description="Pick Identifier"),
    validators = [
        form.Validator("Invalid Identifier", lambda i: i.id == make_id_string(i.id)),
        form.Validator("Invalid Identifier (keyword clash)", lambda i: check_id(i.id))])

class register:
    def GET(self):
        web.header('Content-Type', 'text/html')
        if 'showIdentifierRegistration' not in web.config.session:
            raise web.seeother('/')