]> git.ipfire.org Git - ipfire.org.git/commitdiff
dbl: Make it clearer what the intention is on reports
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 16 Feb 2026 16:31:33 +0000 (16:31 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 16 Feb 2026 16:31:33 +0000 (16:31 +0000)
Too many people selected the wrong option or just stuck with the
default.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/templates/dbl/reports/submit.html
src/web/base.py

index c0267052b72157080ddc5dbd65cf70441279d94f..79ce4c4a85deac29f162d1776942a2f1b78d7ce4 100644 (file)
 
                                        {# Block? #}
                                        <div class="field is-horizontal">
-                                               <div class="field-label is-normal">
-                                                       <label class="label">{{ _("What is wrong?") }}</label>
-                                               </div>
+                                               <div class="field-label is-normal"></div>
 
                                                <div class="field-body">
                                                        <div class="field">
                                                                <div class="control">
                                                                        <div class="select is-fullwidth">
                                                                                <select name="block" required>
-                                                                                       <option value="yes" {% if block %}selected{% end %}>
-                                                                                               {{ _("This domain should be blocked, but isn't") }}
+                                                                                       <option value="">
+                                                                                               {{ _("- Please Select -") }}
+                                                                                       </option>
+
+                                                                                       <option value="yes" {% if block is True %}selected{% end %}>
+                                                                                               {{ _("[BLOCK] This domain should be blocked, but isn't") }}
                                                                                        </option>
 
-                                                                                       <option value="no" {% if not block %}selected{% end %}>
-                                                                                               {{ _("This domain should not be blocked, but currently is") }}
+                                                                                       <option value="no" {% if block is False %}selected{% end %}>
+                                                                                               {{ _("[ALLOW] This domain should not be blocked, but currently is") }}
                                                                                        </option>
                                                                                </select>
                                                                        </div>
index be0fbcb0eca035bf540abae60c0e63ae35c78871..edc35c931e64799731efe1a13be849f4ca456bdb 100644 (file)
@@ -222,12 +222,24 @@ class BaseHandler(tornado.web.RequestHandler):
                return account
 
        def get_argument_bool(self, *args, **kwargs):
-               arg = self.get_argument(*args, default=False, **kwargs)
+               arg = self.get_argument(*args, default=None, **kwargs)
 
-               if arg is False:
+               if arg is None:
+                       return None
+
+               # Conver to lowercase
+               arg = arg.lower()
+
+               # Return True
+               if arg in ("on", "true", "1"):
+                       return True
+
+               # Return False
+               elif arg in ("off", "false", "0"):
                        return False
 
-               return arg.lower() in ("on", "true", "1")
+               # Fail on anything else
+               raise tornado.web.HTTPError(400, "Invalid value for boolean: %s" % arg)
 
        def get_argument_int(self, *args, **kwargs):
                arg = self.get_argument(*args, **kwargs)