コード例 #1
0
    def post(self):
        action = self.get_argument('action', None)
        form = BlockUsernameForm(self.request.arguments)
        unblock_form = UnblockUsernameForm(self.request.arguments)
        message = None

        if action == 'remove':
            if unblock_form.validate():
                username = self.get_argument('username')
                logger.info(self.user_audit_text('Unblocked "%s"'), username)
                BlockedUser.unblock_username(username)
                message = 'User unblocked.'

        else:
            if form.validate():
                username = form.username.data
                logger.info(self.user_audit_text('Blocked "%s"'), username)
                BlockedUser.block_username(username)
                message = 'User blocked.'

        self.render(
            'admin/overview/banned.html',
            message=message,
            form=form, unblock_form=unblock_form,
            usernames=BlockedUser.all_blocked_usernames(),
        )
コード例 #2
0
ファイル: admin.py プロジェクト: whs/terroroftinytown
    def post(self):
        action = self.get_argument('action', None)
        form = BlockUsernameForm(self.request.arguments)
        unblock_form = UnblockUsernameForm(self.request.arguments)
        message = None

        if action == 'remove':
            if unblock_form.validate():
                username = self.get_argument('username')
                logger.info('Unblocked "%s"', username)
                BlockedUser.unblock_username(username)
                message = 'User unblocked.'

        else:
            if form.validate():
                username = form.username.data
                logger.info('Blocked "%s"', username)
                BlockedUser.block_username(username)
                message = 'User blocked.'

        self.render(
            'admin/overview/banned.html',
            message=message,
            form=form, unblock_form=unblock_form,
            usernames=BlockedUser.all_blocked_usernames(),
        )
コード例 #3
0
    def post(self):
        action = self.get_argument("action", None)
        form = BlockUsernameForm(self.request.arguments)
        unblock_form = UnblockUsernameForm(self.request.arguments)
        message = None

        if action == "remove":
            if unblock_form.validate():
                username = self.get_argument("username")
                logger.info('Unblocked "%s"', username)
                BlockedUser.unblock_username(username)
                message = "User unblocked."

        else:
            if form.validate():
                username = form.username.data
                logger.info('Blocked "%s"', username)
                BlockedUser.block_username(username)
                message = "User blocked."

        self.render(
            "admin/overview/banned.html",
            message=message,
            form=form,
            unblock_form=unblock_form,
            usernames=BlockedUser.all_blocked_usernames(),
        )
コード例 #4
0
    def get(self):
        form = BlockUsernameForm()
        unblock_form = UnblockUsernameForm(self.request.arguments)

        self.render(
            'admin/overview/banned.html',
            form=form, unblock_form=unblock_form,
            usernames=BlockedUser.all_blocked_usernames()
        )
コード例 #5
0
ファイル: admin.py プロジェクト: whs/terroroftinytown
    def get(self):
        form = BlockUsernameForm()
        unblock_form = UnblockUsernameForm(self.request.arguments)

        self.render(
            'admin/overview/banned.html',
            form=form, unblock_form=unblock_form,
            usernames=BlockedUser.all_blocked_usernames()
        )