+csv dep for PG'OCaml.
[cocanwiki.git] / scripts / create_user.ml
index e8e136e..a0ff510 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: create_user.ml,v 1.7 2006/03/27 18:09:46 rich Exp $
+ * $Id: create_user.ml,v 1.9 2006/12/06 09:46:57 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -35,13 +35,13 @@ let run r (q : cgi) dbh hostid _ _ =
 
   if username = "" || password1 = "" || password2 = "" then (
     error ~back_button:true ~title:"Bad username or password"
-      dbh hostid q "The username or password you gave is empty.";
+      dbh hostid q "The username or password you gave is empty.";
     return ()
   );
 
   if password1 <> password2 then (
     error ~back_button:true ~title:"Passwords don't match"
-      dbh hostid q "The two passwords you gave aren't identical.";
+      dbh hostid q "The two passwords you gave aren't identical.";
     return ()
   );
 
@@ -49,7 +49,8 @@ let run r (q : cgi) dbh hostid _ _ =
 
   if UTF8.length username > 32 || UTF8.length password > 128 then (
     error ~back_button:true ~title:"Username or password too long"
-      dbh hostid q "Usernames should be less than 32 characters long.  For passwords we let you have a generous 128 characters.";
+      r dbh hostid q
+      "Usernames should be less than 32 characters long.  For passwords we let you have a generous 128 characters.";
     return ()
   );
 
@@ -60,7 +61,7 @@ let run r (q : cgi) dbh hostid _ _ =
   (match rows with
    | [_] ->
        error ~back_button:true ~title:"Username already taken"
-        dbh hostid q "Someone has already taken that username.";
+        dbh hostid q "Someone has already taken that username.";
        return ()
    | [] -> ()
    | _ -> assert false
@@ -72,6 +73,7 @@ let run r (q : cgi) dbh hostid _ _ =
   let can_manage_site = q#param_true "can_manage_site" in
   let can_edit_global_css = q#param_true "can_edit_global_css" in
   let can_import_mail = q#param_true "can_import_mail" in
+  let can_edit_macros = q#param_true "can_edit_macros" in
   let force_password_change = q#param_true "force_password_change" in
 
   (* Create the user account. *)
@@ -80,10 +82,12 @@ let run r (q : cgi) dbh hostid _ _ =
                         hostid, can_edit, can_manage_users,
                         can_manage_contacts, can_manage_site,
                         can_edit_global_css, can_import_mail,
+                        can_edit_macros,
                         force_password_change)
      values ($username, $password, $hostid, $can_edit, $can_manage_users,
              $can_manage_contacts, $can_manage_site,
              $can_edit_global_css, $can_import_mail,
+             $can_edit_macros,
              $force_password_change)";
 
   PGOCaml.commit dbh;
@@ -91,7 +95,7 @@ let run r (q : cgi) dbh hostid _ _ =
   let buttons = [ ok_button "/_users" ] in
 
   ok ~title:"Account created" ~buttons
-    dbh hostid q ("An account was created for " ^ username ^ ".")
+    dbh hostid q ("An account was created for " ^ username ^ ".")
 
 let () =
   register_script ~restrict:[CanManageUsers] run