+let register (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
+ let cgi = Netcgi1_compat.Netcgi_types.of_compat_activation cgi in
+ let env = cgi#environment in
+
+ assert (cgi#arguments <> []);
+ let uid = cgi#argument_value "userid" in
+ let userpw = cgi#argument_value "password" in
+ (try
+ MatitaAuthentication.add_user uid userpw;
+ env#set_output_header_field "Location" "/index.html"
+ with MatitaAuthentication.UsernameCollision _ ->
+ cgi#set_header
+ ~cache:`No_cache
+ ~content_type:"text/html; charset=\"utf-8\""
+ ();
+ cgi#out_channel#output_string
+ "<html><head></head><body>Error: User id collision!</body></html>");
+ cgi#out_channel#commit_work()
+;;