Exemplo n.º 1
0
def confirmlogin_view(request):
    "Handles user logins, checking if a user is new to the system."

    # Check if we do, in fact, have a logged-in user right now
    if not user.is_logged_in():
        raise PermissionDenied # respond with 403 page

    to = request.REQUEST['returnto']
    if not to.startswith('/'): to = '/'

    return redirect(to, False)
Exemplo n.º 2
0
def team_info():
    logged_in = user.is_logged_in()
    my_team = -1
    in_team = False
    owner = False
    _user = None
    teamdata = {}
    search = {}
    teamname = utils.flat_multi(request.args).get("teamname")
    if teamname:
        search.update({"teamname_lower": teamname.lower()})
    if logged_in:
        _user = user.get_user().first()
        if user.in_team(_user):
            my_team = _user.tid
            if "teamname_lower" not in search:
                search.update({"tid": _user.tid})
                in_team = True
    if bool(search) != False:
        team = get_team(**search).first()
        teamdata = get_team_info(**search)
        if logged_in:
            in_team = teamdata["tid"] == _user.tid
            owner = teamdata["captain"] == _user.uid
        teamdata["in_team"] = in_team
        teamdata["my_team"] = my_team
        if in_team:
            teamdata["is_owner"] = owner
            if owner:
                teamdata["pending_invitations"] = team.get_pending_invitations(
                )
                teamdata["invitation_requests"] = team.get_invitation_requests(
                )
        else:
            if logged_in:
                teamdata["invited"] = team.get_pending_invitations(
                    toid=_user.uid) is not None
                teamdata["requested"] = team.get_invitation_requests(
                    frid=_user.uid) is not None
    else:
        if logged_in:
            teamdata["invitations"] = _user.get_invitations()
            teamdata["my_team"] = my_team
            teamdata["tid"] = -1
        else:
            # Non-logged-in user viewing /team page
            raise WebException()
    return {"success": 1, "team": teamdata}
Exemplo n.º 3
0
def team_info():
	logged_in = user.is_logged_in()
	my_team = -1
	in_team = False
	owner = False
	_user = None
	teamdata = { }
	search = { }
	teamname = utils.flat_multi(request.args).get("teamname")
	if teamname:
		search.update({ "teamname_lower": utils.escape_teamname(teamname) })
	if logged_in:
		_user = user.get_user().first()
		if user.in_team(_user):
			my_team = _user.tid
			if "teamname_lower" not in search:
				search.update({ "tid": _user.tid })
				in_team = True
	if bool(search) != False:
		team = get_team(**search).first()
		teamdata = get_team_info(**search)
		if logged_in:
			in_team = teamdata["tid"] == _user.tid
			owner = teamdata["captain"] == _user.uid
		teamdata["in_team"] = in_team
		teamdata["my_team"] = my_team
		if in_team:
			teamdata["is_owner"] = owner
			if owner:
				teamdata["pending_invitations"] = team.get_pending_invitations()
				teamdata["invitation_requests"] = team.get_invitation_requests()
		else:
			if logged_in:
				teamdata["invited"] = team.get_pending_invitations(toid=_user.uid) is not None
				teamdata["requested"] = team.get_invitation_requests(frid=_user.uid) is not None
		teamdata["activity"] = team.get_activity()
	else:
		if logged_in:
			teamdata["invitations"] = _user.get_invitations()
			teamdata["my_team"] = my_team
			teamdata["tid"] = -1
			teamdata["activity"] = []
		else:
			# Non-logged-in user viewing /team page
			raise WebException()
	return { "success": 1, "team": teamdata }
Exemplo n.º 4
0
    from screen import ScreenRes

    try:
        print("Se ha bloqueado su pantalla!")
        ScreenRes.lock_windows()
    except Exception as e:
        print("\x1B[" + "31;40mAn error occurred\u2193\x1B[" + "0m")
        PrintException()
        raise e

if module == "isLoggedIn":
    import user

    try:
        var_ = GetParams("var_")
        is_logged_in = user.is_logged_in()
        SetVar(var_, is_logged_in)
    except Exception as e:
        print("\x1B[" + "31;40mAn error occurred\u2193\x1B[" + "0m")
        PrintException()
        raise e

if module == "maximizeWindow":
    import window

    title = GetParams("title")
    try:
        window.maximize_window(title)
    except Exception as e:
        print("\x1B[" + "31;40mAn error occurred\u2193\x1B[" + "0m")
        PrintException()