*** empty log message ***

svn path=/trunk/boinc/; revision=7216
This commit is contained in:
David Anderson 2005-08-09 18:46:53 +00:00
parent 8ce680e85c
commit b36fef1e87
5 changed files with 143 additions and 0 deletions

View File

@ -0,0 +1,48 @@
<?php
// RPC handler for account creation
require_once("../inc/db.inc");
require_once("../inc/util.inc");
require_once("../inc/email.inc");
require_once("../inc/xml.inc");
db_init();
xml_header();
$config = get_config();
if (parse_bool($config, "disable_account_creation")) {
echo "<error_num>-208</error_num>\n";
exit();
}
$email_addr = get_str("email_addr");
$email_addr = process_user_text(strtolower($email_addr));
$passwd_hash = process_user_text(get_str("passwd_hash"));
$user_name = process_user_text(get_str("user_name"));
if (!is_valid_email_addr($email_addr)) {
echo "<error_num>-205</error_num>\n";
exit();
}
if (strlen($passwd_hash) != 32) {
echo "<error_num>-206</error_num>\n";
exit();
}
$authenticator = random_string();
$cross_project_id = random_string();
$now = time();
$query = "insert into user (create_time, email_addr, name, authenticator, send_email, show_hosts, cross_project_id, passwd_hash) values($now, '$email_addr', '$user_name', '$authenticator', 1, 1, '$cross_project_id', '$authenticator')";
$result = mysql_query($query);
if (!$result) {
echo "<error_num>-207</error_num>\n";
exit();
}
echo "<error_num>0</error_num>\n";
echo "<authenticator>$authenticator</authenticator>\n";
?>

View File

@ -0,0 +1,33 @@
<?php
require_once("../inc/db.inc");
require_once("../inc/util.inc");
require_once("../inc/user.inc");
db_init();
$user = get_logged_in_user();
$passwd = strtolower(process_user_text(post_str("passwd")));
$passwd2 = strtolower(process_user_text(post_str("passwd2")));
page_head("Change password");
if ($passwd != $passwd2) {
error_page("passwords are different");
}
$passwd_hash = md5($passwd.$user->email_addr);
$result = mysql_query("update user set passwd_hash='$passwd_hash' where id=$user->id");
if ($result) {
echo "password changed";
} else {
echo "
We can't update your password due to a database problem.
Please try again later.
";
}
page_tail();
?>

View File

@ -0,0 +1,21 @@
<?php
require_once("../inc/db.inc");
require_once("../inc/util.inc");
db_init();
$user = get_logged_in_user();
page_head("Change password");
echo "<form method=post action=edit_passwd_action.php>\n";
start_table();
row1("Change password");
row2("New password", "<input type=password name=passwd size=30>");
row2("New password, again", "<input type=password name=passwd2 size=30>");
row2("", "<input type=submit value='Change password'>");
end_table();
echo "</form>\n";
page_tail();
?>

View File

@ -0,0 +1,14 @@
<?php
require_once("../inc/xml.inc");
xml_header();
echo "
<project_config>
<uses_email_id>1</uses_email_id>
<name>Example name</name>
<min_passwd_length>7</min_passwd_length>
</project_config>
";
?>

View File

@ -0,0 +1,27 @@
<?php
// RPC handler for account lookup
require_once("../inc/db.inc");
require_once("../inc/util.inc");
require_once("../inc/email.inc");
require_once("../inc/xml.inc");
db_init();
xml_header();
$email_addr = get_str("email_addr");
$passwd_hash = process_user_text(get_str("passwd_hash"));
$user = lookup_user_email_addr($email_addr);
if (!$user) {
echo "<error_num>-161</error_num>\n";
exit();
}
echo "<error_num>0</error_num>
<authenticator>$user->authenticator</authenticator>
";
?>