web site: accounts, login

svn path=/trunk/boinc/; revision=597
This commit is contained in:
David Anderson 2002-11-11 10:26:40 +00:00
parent 9c4bbdcf6f
commit 1b92e7781a
18 changed files with 215 additions and 298 deletions

View File

@ -2356,3 +2356,32 @@ David Nov 9 2002
test_uc.php test_uc.php
tools/ tools/
process_result_template.C process_result_template.C
David Nov 9 2002
- Simplified account creation.
Only screen name, email address required; country, zip optional.
Only account ID required to log in
Removed web password from form;
projects can add this if they want.
- Change "authenticator" to "account ID" everywhere
- made country list appear on account creation form
todo
db/
constraints.sql
db.h
doc/
account.html
app.html
create_project.html
participate.html
startup.html
html_user/
renamed create_account.php to create_account_form.php
renamed login.php to login_form.php
download.php
index.php
login_action.php
util.inc
test/
test_uc.php

View File

@ -11,6 +11,8 @@ alter table app_version
alter table user alter table user
add unique(email_addr); add unique(email_addr);
alter table user
add unique(authenticator);
alter table user alter table user
add index ind_tid (teamid); add index ind_tid (teamid);

View File

@ -102,7 +102,7 @@ struct USER {
unsigned int create_time; unsigned int create_time;
char email_addr[256]; char email_addr[256];
char name[256]; char name[256];
char web_password[256]; char web_password[256]; // optional
char authenticator[256]; char authenticator[256];
char country[256]; char country[256];
char postal_code[256]; char postal_code[256];

View File

@ -10,20 +10,17 @@ This involves filling out a form with
<ul> <ul>
<li> An email address. <li> An email address.
<li> A public "screen name" (real name or nickname). <li> A public "screen name" (real name or nickname).
This also serves as your login name for the project's web site.
<li> A web password
(used to log in to the project's web site).
<li> Country (optional) <li> Country (optional)
<li> Postal Code (optional) <li> Postal Code (optional)
</ul> </ul>
<li> You will receive an email containing an <b>account ID</b> <li> You will receive an email containing an <b>account key</b>
(a long random string). (a long random string).
<li> Download and install the BOINC client program. <li> Download and install the BOINC client program.
It will ask for a project URL and an account ID. It will ask for a project URL and an account key.
Enter the project's URL, Enter the project's URL,
cut and paste the account ID from the email. cut and paste the account key from the email.
</ol> </ol>
<p> <p>

View File

@ -1,15 +1,11 @@
<title>Platforms, applications, and versions</title> <title>Applications and versions</title>
<body bgcolor=ffffff> <body bgcolor=ffffff>
<h2>Platforms, applications, and versions</h2> <h2>Applications and versions</h2>
<p>
A <b>platform</b> is a compilation target (Windows/Intel,
Linux/Intel, MacOS/PPC, etc.).
Platforms are maintained in the <b>platform</b> table in the BOINC DB,
and can be created using the <a href=tools_other.html>add</a> utility.
<p> <p>
An <b>application</b> consists of an executable program, An <b>application</b> represents a particular distributed computation;
perhaps with versions for various platforms. it consists of a program (perhaps with versions for different platforms)
and a set of workunits and results.
A project can operate many applications. A project can operate many applications.
Applications are maintained in the <b>application</b> table in the BOINC DB, Applications are maintained in the <b>application</b> table in the BOINC DB,
and can be created using the <a href=tools_other.html>add</a> utility. and can be created using the <a href=tools_other.html>add</a> utility.
@ -32,13 +28,14 @@ Mac version 304.
<p> <p>
Each application has a <b>minimum version</b>. Each application has a <b>minimum version</b>.
When a client is sent work for an application, it is also sent When a client is sent work for an application,
the latest application version for its platform. it is also sent the latest application version for its platform.
It is sent work only if this version is the minimum or greater. It is sent work only if this version is the minimum or greater.
<p> <p>
Application versions are maintained in the <b>app_version</b> table Application versions are maintained in the <b>app_version</b> table
in the BOINC DB, Each entry includes an XML document describing the in the BOINC DB.
Each entry includes an XML document describing the
files that make up the application version: files that make up the application version:
<pre> <pre>
&lt;file_info&gt; ... &lt;file_info&gt; ...
@ -57,5 +54,5 @@ files that make up the application version:
&lt;/file_ref&gt; &lt;/file_ref&gt;
&lt;/app_version&gt; &lt;/app_version&gt;
</pre> </pre>
The <a href=tools_other.html>add</a> utility provides a Application versions can be created using the
simplified interface for creating application versions. <a href=tools_other.html>add</a> utility program.

View File

@ -1,4 +1,5 @@
<title>Creating a BOINC project</title> <title>Creating a BOINC project</title>
<body bgcolor=ffffff>
<h2>Creating a BOINC project</h2> <h2>Creating a BOINC project</h2>
<font size=+1><b> <font size=+1><b>

View File

@ -1,3 +1,5 @@
<title>Participating in BOINC projects</title>
<body bgcolor=ffffff>
<h3>Participating in BOINC projects</h3> <h3>Participating in BOINC projects</h3>
<ul> <ul>
<li> <a href="account.html">Joining a project</a> <li> <a href="account.html">Joining a project</a>

View File

@ -6,19 +6,19 @@
You can join a second and subsequent projects as follows. You can join a second and subsequent projects as follows.
<ol> <ol>
<li> Visit the new project's web site and create an account. <li> Visit the new project's web site and create an account.
Note: if you wish, you can use different email, user name or password Note: if you wish, you can use different email and name
than those of your first account. than those of your first account.
<li> Receive an email containing an account ID (a long random string). <li> Receive an email containing an account key (a long random string).
<li> Run the BOINC <li> Run the BOINC client, and select the <b>Add Project</b> command.
Enter the project's URL and your account key.
</ol> </ol>
<h3>How preferences are stored</h3> <h3>Where to edit your preferences</h3>
<p> <p>
Your preferences are stored on BOINC servers. Your preferences are stored on BOINC servers.
When your hosts communicate with a server they get the When your hosts communicate with a server they get the latest preferences,
latest preferences, and they pass along these preferences and they pass along these preferences to other servers.
to other servers.
Thus, when you change your preferences on one project's web site, Thus, when you change your preferences on one project's web site,
these changes will quickly spread to all your hosts, these changes will quickly spread to all your hosts,
and to the web sites of all the other projects in which you participate. and to the web sites of all the other projects in which you participate.

View File

@ -1,13 +0,0 @@
<?php
include_once("db.inc");
include_once("util.inc");
include_once("login.inc");
include_once("prefs.inc");
db_init();
page_head("Create User Account");
print_create_account_form();
page_tail();
?>

View File

@ -0,0 +1,69 @@
<?php
include_once("util.inc");
page_head("Create account");
?>
<form method=post action=create_account_action.php>
<table cellpadding=8>
<tr><td align=right>
<b>Name or nickname:</b>
<br><font size=-1> Your identifier on our web site. Use your real name or a nickname.</font>
</td><td>
<input name=new_name size=30>
</td></tr>
<tr><td align=right>
<b>Email address:</b>
<br><font size=-1>Your <b>account key</b> will be emailed to this address.</font>
</td><td>
<input name=new_email_addr size=50>
</td></tr>
<!--
<tr><td align=right>
<b>Password:</b>
<br><font size=-1>Used to log in to your account</font>
</td><td>
<input name=new_password type=password>
</td></tr>
<tr><td align=right>
<b>Retype password to confirm:</b>
</td><td>
<input name=new_password2 type=password>
</td></tr>
-->
<tr><td align=right>
<b>Country:</b>
<br><font size=-1>select the country you wish to represent, if any.</font>
</td><td>
<select name=country>
<?php
print_country_select();
?>
</select>
</td></tr>
<tr><td align=right>
<b>Postal (ZIP) code:</b>
</td><td>
<input name=postal_code size=20>
</td></tr>
<tr><td align=right>
<br>
</td><td>
<input type=submit value="Create account">
</td></tr>
</table>
</form>
<?php
page_tail();
?>

View File

@ -2,48 +2,39 @@
require_once("util.inc"); require_once("util.inc");
require_once("db.inc"); require_once("db.inc");
db_init(); page_head("Home page");
$user = get_user_from_cookie();
printf(
"<head>\n"
."<title>".PROJECT."</title>\n"
."</head>\n"
."<body text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000>\n"
."<table width=780>\n"
."<tr><td><h1 align=center>".PROJECT."</h1></td></tr>\n"
);
if ($user) {
echo "<tr><td><h3>Welcome $user->name</h3>\n";
echo "If you are not $user->name or would wish to log in as another user ";
echo "<a href=login.php>login here</a>.";
} else {
echo "<tr><td>\n";
}
?> ?>
<p> <h3>What we're doing</h3>
This distributed computing project is running on the BOINC software platform. The Astropulse project, based at UC Berkeley,
BOINC is a software platform for public-participation distributed uses the idle time of thousands of computers to
computing projects. analyze radio telescope signals.
Users are allowed to simultaneously participate in multiple projects Astropulse uses <a href=http://boinc.berkeley.edu>BOINC</a>,
and to choose how to allocate their resources for each project. which allows you to participate in multiple
distributed computing projects at the same time.
<h3>Joining this project</h3>
First, <a href=create_account.php>create an account</a>.
You will be sent an authenticator
to the email specified.
After successfully creating an account,
<a href=download.php>download the BOINC client</a>.
Install and run the client.
When it asks you for authenticator,
cut and paste the authenticator from the email.
<h3>How to join</h3>
<ul> <ul>
<li><a href=create_account.php>Create account</a></li> <li>
<li><a href=download.php>Download core client</a></li> First, <a href=create_account_form.php>create an account</a>.
<li><a href=login.php>Login</a></li> You will be asked for your email address.
<li><a href=home.php>User home page</a></li> - view stats, modify preferences An <b>account key</b> will be emailed to you.
<li><a href=team.php>Teams</a></li> - join sample distributed computing project community <li> If you don't already have it,
<a href=download.php>download the BOINC client</a>.
Install and run the client, and give it your account key.
<li> If you're already running the BOINC client,
select the <b>Add project</b> command
and give it your account key.
</ul> </ul>
</td></tr></table>
</body> <h3>Returning participants</h3>
<ul>
<li><a href=login_form.php>Log in</a></li>
<li><a href=home.php>User page</a></li> - view stats, modify preferences
<li><a href=team.php>Teams</a></li> - create or join a team
</ul>
<?php
page_tail();
?>

View File

@ -1,93 +0,0 @@
<?php
function print_login_form() {
page_head("Log in");
echo "<form method=post action=login_action.php>\n"
.TABLE2."\n
<tr><td colspan=2><b>Enter the email address and password of your account to login:</b></td></tr>\n
<tr><td><br></td></tr>\n
<tr>\n
<td align=right>Email Address</td>\n
<td> <input name=existing_email type=text size=40></td>\n
</tr>\n
<tr>\n
<td align=right>Password</td>\n
<td> <input name=existing_password type=password></td>\n
</tr>\n
<tr>\n
<td><br></td>\n
<td><input type=submit name=old value=\"Log in\"></td>\n
</tr>\n
</table>\n
</form>\n
<br>\n"
.TABLE2."\n
<tr><td>If you don't have an account, please <a href=create_account.php>create a new one</a></td</tr>\n
</table>\n";
page_tail();
}
function print_create_account_form() {
printf(
"<form method=post action=login_action.php>\n"
.TABLE2."\n"
."<tr><td><b>To create a new account, please fill out the following information:</b></td></tr>\n"
."<tr><td><br></td></tr>\n"
."<tr>\n"
." <td><b>Name or nickname:</b>".SM_FONT." this is the name that will be seen by other users on the web.</font></td>\n"
."</tr>\n"
."<tr>\n"
." <td><input name=new_name size=30></td>\n"
."</tr>\n"
."<tr><td><br></td></tr>\n"
."<tr>\n"
." <td><b>Email address:</b>".SM_FONT." ex.john@mailserver.com - this is what you will be using to login to your account. The address you enter\n"
."must be valid in order for you to create an account; a unique BOINC key will be sent to it to make sure it is valid.</font></td>\n"
."</tr>\n"
."<tr>\n"
." <td><input name=new_email_addr size=50></td>\n"
."</tr>\n"
."<tr><td><br></td></tr>\n"
."<tr>\n"
." <td><b>Password:</b>".SM_FONT." remember this password - you may need it to access your account in the future.</font></td>\n"
."</tr>\n"
."<tr>\n"
." <td><input name=new_password type=password></td>\n"
."</tr>\n"
."<tr><td><br></td></tr>\n"
."<tr>\n"
." <td><b>Retype password to confirm:</b></td>\n"
."</tr>\n"
."<tr>\n"
." <td><input name=new_password2 type=password></td>\n"
."</tr>\n"
."<tr><td><br></td></tr>\n"
."<tr>\n"
." <td><b>Country:</b>".SM_FONT." select from the list below the country you wish to represent.</font></td>\n"
."</tr>\n"
."<tr>\n"
." <td><select name=country>\n"
);
print_country_select();
printf(
" </select>\n"
." </td>\n"
."</tr>\n"
."<tr><td><br></td></tr>\n"
."<tr>\n"
." <td><b>Postal (ZIP) code:</b></td>\n"
."</tr>\n"
."<tr>\n"
." <td><input name=postal_code size=20></td>\n"
."</tr>\n"
."<tr><td><br></td></tr>\n"
."<tr>\n"
." <td><input type=submit name=new value=\"Create account\"></td>\n"
."</tr>\n".
"</table>\n"
."</form>\n"
);
}
?>

View File

@ -1,10 +0,0 @@
<?php
require_once("util.inc");
require_once("login.inc");
db_init();
$head = sprintf("Login to %s", PROJECT);
page_head("$head");
print_login_form();
page_tail();
?>

View File

@ -4,111 +4,33 @@
require_once("db.inc"); require_once("db.inc");
db_init(); db_init();
if (strlen($HTTP_POST_VARS["old"])) { $authenticator = $HTTP_POST_VARS["authenticator"];
$query = sprintf( $email_addr = $HTTP_POST_VARS["email_addr"];
"select * from user where email_addr='%s'", $password = $HTTP_POST_VARS["password"];
$HTTP_POST_VARS["existing_email"] if (strlen($authenticator)) {
); $query = "select * from user where authenticator='$authenticator'";
$result = mysql_query($query); }
if ($result) { $query = sprintf(
$user = mysql_fetch_object($result); $query = "select * from user where email_addr='$email_addr'";
mysql_free_result($result); );
} $result = mysql_query($query);
if (!$user) { if ($result) {
page_head("Logging in"); $user = mysql_fetch_object($result);
echo "There is no account with the email address you have entered.\n"; mysql_free_result($result);
echo "Click the <b>Back</b> button to re-enter email address.\n"; }
} else if ($user->web_password != $HTTP_POST_VARS["existing_password"]) { if (!$user) {
page_head("Logging in"); page_head("Log in");
echo BADPASS; echo "There is no account with the account key or email address you have entered.\n";
} else { echo "Click the <b>Back</b> button to try again.\n";
setcookie("auth", $user->authenticator, time()+100000000); } else if (strlen($password)) {
page_head("User Page"); page_head("Log in");
show_user_page_private($user); if ($user->web_password != $HTTP_POST_VARS["existing_password"]) {
} echo "Bad password.";
} else if (strlen($HTTP_POST_VARS["new"])) {
$query = sprintf(
"select * from user where email_addr='%s'",
$HTTP_POST_VARS["new_email_addr"]
);
$result = mysql_query($query);
if ($result) {
$user = mysql_fetch_object($result);
mysql_free_result($result);
}
if (strlen($HTTP_POST_VARS["new_email_addr"]) == 0) {
page_head("Creating Account");
printf(
TABLE2."\n"
."<tr><td>You must enter an email address to create an account.\n"
."</td></tr>\n"
."</table>"
);
} else if (strlen($HTTP_POST_VARS["new_password"]) == 0) {
page_head("Creating Account");
printf(
TABLE2."\n"
."<tr><td>You must enter a web password to create an account.\n"
."</td></tr>\n"
."</table>"
);
} else if ($user) {
page_head("Creating Account");
printf(
TABLE2."\n"
."<tr><td>There's already an account with that email address. Click the <b>Back</b> button\n"
." on your browser to edit your information, or <a href=login.php>login </a>to your \n"
.PROJECT." account.</td></tr>\n"
."</table>\n"
);
} else {
if ($HTTP_POST_VARS["new_password"] != $HTTP_POST_VARS["new_password2"]) {
page_head("Creating Account");
printf(
TABLE2."\n"
."<tr><td>".DIFFPASS
."</td></tr>\n"
."</table>\n"
);
} else {
$authenticator = random_string();
$email_addr = $HTTP_POST_VARS["new_email_addr"];
$query = sprintf(
"insert into user (create_time, email_addr, name, web_password, authenticator, country, postal_code, global_prefs, project_prefs) values(%d, '%s', '%s', '%s', '%s', '%s', %d, '', '')",
time(),
$email_addr,
$HTTP_POST_VARS["new_name"],
$HTTP_POST_VARS["new_password"],
$authenticator,
$HTTP_POST_VARS["country"],
$HTTP_POST_VARS["postal_code"]
);
$result = mysql_query($query);
if ($result) {
setcookie("auth", $authenticator);
page_head("Creating Account");
echo TABLE2."\n
<tr><td>
Your account has been created successfully.
In order to run the client you will need a BOINC key.
A key will be sent to the email address you provided,
and you can simply copy and paste the key,
which will be a string of letters and numbers,
in the location indicated when you run the client.
</td></tr>\n
<tr><td><br><br></td></tr>\n
<tr><td><a href=download.php>Download core client</a></td></tr>\n
</table>\n";
mail($email_addr, "BOINC key", "Your BOINC key is " . $authenticator);
} else {
page_head("Creating Account");
echo TABLE2."\n
<tr><td>Couldn't create account.
Please try again later.</td></tr>\n
</table>\n";
}
}
} }
} else {
setcookie("auth", $user->authenticator, time()+100000000);
page_head("User Page");
show_user_page_private($user);
} }
page_tail(); page_tail();
?> ?>

21
html/user/login_form.php Normal file
View File

@ -0,0 +1,21 @@
<?php
require_once("util.inc");
page_head("Log in");
echo "<form method=post action=login_action.php>
<table cellpadding=8>
<tr><td align=right>
Your account key:
</td><td>
<input name=account_key size=40>
</td></tr>
<tr><td align=right>
<br>
</td><td>
<input type=submit value='Log in'>
</td></tr>
</table>";
page_tail();
?>

View File

@ -21,9 +21,7 @@ define("TITLE_COLOR", " bgcolor=000000 ");
define("TITLE_FONT", " <font color=ffffff> "); define("TITLE_FONT", " <font color=ffffff> ");
define("BODY_COLOR", " bgcolor=ffffff "); define("BODY_COLOR", " bgcolor=ffffff ");
define("NOLOGIN", "Not logged in. Click <a href=login.php>here</a> to login.\n"); define("NOLOGIN", "Not logged in. Click <a href=login.php>here</a> to login.\n");
define("BADPASS", "The password you entered is incorrect. Click the <b>Back</b> button on your browser to re-enter your password or try again later."); define("PROJECT", "Astropulse");
define("DIFFPASS", "You've typed two different passwords. Click the <b>Back</b> button on your browser to edit your information, making sure you type the same password in both password fields.");
define("PROJECT", "Sample project");
function get_user_from_cookie() { function get_user_from_cookie() {
@ -49,7 +47,7 @@ function page_head($title) {
// Put your project title and logo here // Put your project title and logo here
echo "<h2>Sample Project</h2>\n"; echo "<h2>".PROJECT."</h2><hr>\n";
echo "<h3>$title</h3>\n"; echo "<h3>$title</h3>\n";
} }

View File

@ -9,15 +9,15 @@
$user = new User(); $user = new User();
$host = new Host($user); $host = new Host($user);
// the following is optional
$app = new App("core_client");
$app_version = new App_Version($app);
$project->add_app($app);
$project->add_app_version($app_version);
$app = new App("upper_case"); $app = new App("upper_case");
$app_version = new App_Version($app); $app_version = new App_Version($app);
// the following is optional (makes client web download possible)
$core_app = new App("core client");
$core_app_version = new App_Version($core_app);
$project->add_app($core_app);
$project->add_app_version($core_app_version);
$project->add_user($user); $project->add_user($user);
$project->add_app($app); $project->add_app($app);
$project->add_app_version($app_version); $project->add_app_version($app_version);

6
todo
View File

@ -1,4 +1,8 @@
protection mechanism for project admin web use PHP session mechanism instead of our own cookies
use https for login (don't sent account key or password in clear)
protect project admin web pages (htaccess)
Deadline mechanism for results Deadline mechanism for results
- use in result dispatching - use in result dispatching