X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=scripts%2Finvite_user_confirm.ml;h=45374c546a2042ea53a759d4114b98c17fb7bb9f;hb=a91aac39ca718af3ad1f446742c3d200da60f4b6;hp=3f45c3441cdf65b54a8a8ca55be4936b5759fb0b;hpb=0bbc87f2b064e8080f18e77ffcadcd6348ecd9be;p=cocanwiki.git diff --git a/scripts/invite_user_confirm.ml b/scripts/invite_user_confirm.ml index 3f45c34..45374c5 100644 --- a/scripts/invite_user_confirm.ml +++ b/scripts/invite_user_confirm.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: invite_user_confirm.ml,v 1.1 2004/10/14 15:57:15 rich Exp $ + * $Id: invite_user_confirm.ml,v 1.2 2004/10/23 15:00:15 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 @@ -33,16 +33,13 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = let template = _get_template "invite_user_confirm.txt" in let username = q#param "username" in - let old_password = q#param "old_password" in + let invite = q#param "invite" in - assert (String.length old_password = 32 && - string_for_all isxdigit old_password); - - (* Verify the username, old_password combination. *) + (* Verify the username, invite combination. *) let sth = dbh#prepare_cached "select email, id from users where hostid = ? and - name = ? and password = ?" in - sth#execute [`Int hostid; `String username; `String old_password]; + name = ? and invite = ?" in + sth#execute [`Int hostid; `String username; `String invite]; let email, userid = try @@ -51,9 +48,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = | [ `Null; `Int userid ] -> None, userid | _ -> assert false with Not_found -> - error ~title:"Bad password" - ~back_button:true - q "The password you gave is wrong."; + error ~title:"Already signed up" + q "It looks like you have already used your invitation."; return () in let password1 = q#param "password1" in @@ -76,7 +72,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = (* Change the password. *) let sth = dbh#prepare_cached - "update users set password = ?, force_password_change = false + "update users set password = ?, invite = null, + force_password_change = false where hostid = ? and id = ?" in sth#execute [`String password; `Int hostid; `Int userid];