chiark / gitweb /
Fix quiz question to use standard machinery
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 6 Jun 2023 19:30:57 +0000 (20:30 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 6 Jun 2023 19:52:13 +0000 (20:52 +0100)
bcp5-registry.pl
template.html

index a1542e9f1f540eb0e36cc7023cba968e1ceff35b..b0c7690461427105496b310b26a2f61105e42c85 100755 (executable)
@@ -206,11 +206,9 @@ if ($invokestyle eq 'maintain') {
 } elsif (length $in{'mailpasswd'}) {
 
     if (! $in{'quiz'}) {
-        print "Please answer the quiz question.";
-       exit 0;
+        finish_error('noquiz');
     } elsif ($in{'quiz'} !~ m{^(?:bcp5|rfc1918)$}i) {
-       print "Wrong answer to the quiz question.";
-       exit 0;
+        finish_error('badquiz');
     }
 
     read_database();
@@ -437,7 +435,7 @@ sub finish_error ($) {
     my ($type) = @_;
     my ($t, $esel, $f);
     foreach $t (qw(noemail nonet noname nocontact badsize wrongsize badnet wrongnet
-                  nopassword badpassword notfound badchar)) {
+                  nopassword badpassword notfound badchar noquiz badquiz)) {
        $esel= "error_$t";
        $$esel= 0;
        $f=1 if $type eq $t;
index 7fadf1b91b0d565c95ab75390c93746c7d026d96..a6236c036e9b49d86550e2ca1138275de5f8223f 100644 (file)
@@ -219,6 +219,14 @@ You must provide a network name for the database.
 The name, contact or email address you specified contains illegal character(s).
 @@@endif:@@@
 
+@@@if:error_noquiz@@@
+Please answer the quiz question, to prove you're not a robot.
+@@@endif:@@@
+
+@@@if:error_badquiz@@@
+Wrong answer to the quiz question.
+@@@endif:@@@
+
 @@@endif:@@@