(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* 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
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
| [ `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
(* 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];