web RPC additions

svn path=/trunk/boinc/; revision=9088
This commit is contained in:
David Anderson 2005-12-19 07:42:40 +00:00
parent 8770dae99f
commit 6374d88da0
5 changed files with 41 additions and 14 deletions

View File

@ -14582,10 +14582,21 @@ David 17 Dec 2005
py/Boinc/
setup_project.py
David 17 Dec 2005
David 18 Dec 2005
- compile fix: include config.h where needed
lib/
boinc_cmd.C
filesys.C
shmem.C
David 18 Dec 2005
- extend the am_set_info.php RPC to let you
change email address and password_hash.
html/
inc/
email.inc
user/
am_set_info.php
edit_email_action.php

View File

@ -59,7 +59,7 @@ to the account manager, obtaining a list of accounts.
It then attaches to these accounts and proceeds.
</ol>
The <b>create account</b> RPCs
RPCs to create, look up, and modify accounts
are described <a href=web_rpc.php>here</a>.
<h2>Core client functionality</h2>

View File

@ -35,6 +35,19 @@ function send_email($user, $subject, $body) {
return mail($user->email_addr, $subject, $body, $headers);
}
}
function send_verify_email($old, $new, $user) {
$x = md5($new.$user->authenticator);
mail(
$new,
PROJECT." account email change",
"The email address of your " . PROJECT . " account has been changed from $old to $new.
To validate the new address, visit the URL:
".URL_BASE."validate_email.php?u=$user->id&x=$x
"
);
}
// Send an email describing an account to the user.
// There are a few scenarios:
//

View File

@ -3,6 +3,7 @@
require_once("../inc/db.inc");
require_once("../inc/xml.inc");
require_once("../inc/team.inc");
require_once("../inc/email.inc");
function reply($x) {
echo "<am_set_info_reply>
@ -43,6 +44,8 @@ $send_email = process_user_text($_GET["send_email"]);
$show_hosts = process_user_text($_GET["show_hosts"]);
$teamid = get_int("teamid", true);
$venue = process_user_text($_GET["venue"]);
$email_addr = strtolower(process_user_text($_GET["email_addr"]));
$password_hash = process_user_text($_GET["password_hash"]);
$query = "";
if ($name) {
@ -80,9 +83,21 @@ if ($teamid) {
if ($venue) {
$query .= " venue='$venue', ";
}
if ($email_addr && $email_addr!=$user->email_addr) {
$old_email_addr = $user->email_addr;
$query .= " email_addr='$email_addr', ";
}
if ($password_hash) {
$password_hash .= " password_hash='$password_hash', ";
}
// the seti_id=seti_id is to make it legal if no fields updated
//
$result = mysql_query("update user set $query seti_id=seti_id where id=$user->id");
if ($result) {
if ($old_email_addr) {
send_verify_email($old_email_addr, $email_addr, $user);
}
success("");
} else {
error("database error");

View File

@ -5,18 +5,6 @@ require_once("../inc/util.inc");
require_once("../inc/email.inc");
require_once("../inc/user.inc");
function send_verify_email($old, $new, $user) {
$x = md5($new.$user->authenticator);
mail(
$new,
PROJECT." account email change",
"The email address of your " . PROJECT . " account has been changed from $old to $new.
To validate the new address, visit the URL:
".URL_BASE."validate_email.php?u=$user->id&x=$x
"
);
}
db_init();
$user = get_logged_in_user();