X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=scripts%2Fcreate_user.ml;h=5f6be277719de7bd0be62d67fae443e294590aa9;hb=1b592b922676bd3080338cf532a3d29d38137189;hp=dc72b3b5ab731bc405c90986dd89784de5acd01e;hpb=867889b6d04b6381c74974e338672ee02d61920e;p=cocanwiki.git diff --git a/scripts/create_user.ml b/scripts/create_user.ml index dc72b3b..5f6be27 100644 --- a/scripts/create_user.ml +++ b/scripts/create_user.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: create_user.ml,v 1.1 2004/09/21 13:01:15 rich Exp $ + * $Id: create_user.ml,v 1.3 2004/09/23 11:56:47 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 @@ -36,13 +36,13 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = if username = "" || password1 = "" || password2 = "" then ( error ~back_button:true ~title:"Bad username or password" q "The username or password you gave is empty."; - raise CgiExit + return () ); if password1 <> password2 then ( error ~back_button:true ~title:"Passwords don't match" q "The two passwords you gave aren't identical."; - raise CgiExit + return () ); let password = password1 in @@ -64,22 +64,26 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = sth#fetch1 (); error ~back_button:true ~title:"Username already taken" q "Someone has already taken that username."; - raise CgiExit + return () with Not_found -> ()); let can_edit = q#param_true "can_edit" in let can_manage_users = q#param_true "can_manage_users" in let can_manage_contacts = q#param_true "can_manage_contacts" in + let can_manage_site = q#param_true "can_manage_site" in + let can_edit_global_css = q#param_true "can_edit_global_css" in (* Create the user account. *) let sth = dbh#prepare_cached "insert into users (name, password, email, hostid, can_edit, can_manage_users, - can_manage_contacts) - values (?, ?, ?, ?, ?, ?, ?)" in + can_manage_contacts, can_manage_site, + can_edit_global_css) + values (?, ?, ?, ?, ?, ?, ?, ?, ?)" in sth#execute [`String username; `String password; email; `Int hostid; `Bool can_edit; `Bool can_manage_users; - `Bool can_manage_contacts]; + `Bool can_manage_contacts; `Bool can_manage_site; + `Bool can_edit_global_css]; dbh#commit ();