git.annexia.org
/
cocanwiki.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added machine-parsable links database, per-page links and page source.
[cocanwiki.git]
/
scripts
/
invite_user_confirm.ml
diff --git
a/scripts/invite_user_confirm.ml
b/scripts/invite_user_confirm.ml
index
3f45c34
..
45374c5
100644
(file)
--- 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 <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
(* 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
*
* 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 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
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
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 ->
| [ `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
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
(* 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];
where hostid = ? and id = ?" in
sth#execute [`String password; `Int hostid; `Int userid];