- web: show "logged in as" info on every page;

remove funky "log out" link from user page
- web: go to home page on logout,
    not dorky "you are logged out" page


svn path=/trunk/boinc/; revision=23387
This commit is contained in:
David Anderson 2011-04-20 14:50:50 +00:00
parent b062bd03f4
commit a3cccc85e6
6 changed files with 48 additions and 13 deletions

View File

@ -2337,7 +2337,7 @@ David 19 Apr 2011
sched_types.cpp
David 19 Apr 2011
- admin web: all specifying an SVN config dir in the web config file,
- admin web: allow specifying an SVN config dir in the web config file,
in case your svn requires a proxy or something.
From Boris Dayma.
@ -2346,3 +2346,19 @@ David 19 Apr 2011
index.php
project.sample/
project.inc
David 20 Apr 2011
- web: show "logged in as" info on every page;
remove funky "log out" link from user page
- web: go to home page on logout,
not dorky "you are logged out" page
html/
inc/
user.inc
util.inc
user/
sample_index.php
logout.php
project.sample/
project.inc

View File

@ -211,7 +211,6 @@ function show_user_info_private($user) {
| <a href=\"".SECURE_URL_BASE."/edit_passwd_form.php\">".tra("password")."</a>
| <a href=\"edit_user_info_form.php?$url_tokens\">".tra("other account info")."</a>"
);
row2("", "<a href=\"logout.php?$url_tokens\">".tra("Log out")."</a>");
row2(tra("User ID")."<br/><span class=\"note\">".tra("Used in community functions")."</span>", $user->id);
if (!no_computing()) {
row2(tra("Account key")."<br/><span class=\"note\">".tra("Provides full access to your account")."</span>", $user->authenticator);

View File

@ -72,10 +72,11 @@ function get_user_from_id($id) {
}
$g_logged_in_user = null;
$got_logged_in_user = false;
function get_logged_in_user($must_be_logged_in=true) {
global $g_logged_in_user;
if ($g_logged_in_user) return $g_logged_in_user;
global $g_logged_in_user, $got_logged_in_user;;
if ($got_logged_in_user) return $g_logged_in_user;
check_web_stopped();
@ -101,13 +102,23 @@ function get_logged_in_user($must_be_logged_in=true) {
return $g_logged_in_user;
}
function show_login($user) {
function show_login_info() {
$user = get_logged_in_user(false);
echo "
<table width=100% cellpadding=0 cellspacing=0>
<td align=right>
";
if ($user) {
echo tra("Logged in as %1.", $user->name)."\n";
echo "<br><a href=\"login_form.php\">".tra("Log in as someone else.")."</a>\n";
$url_tokens = url_tokens($user->authenticator);
echo "$user->name | <a href=".$prefix."logout.php?$url_tokens>".tra("log out")."</a>";
} else {
echo tra("Not logged in.");
echo "<a href=".$prefix."login_form.php>".tra("log in")."</a>";
}
echo "
</td>
</tr>
</table>
";
}
$cache_control_extra="";
@ -154,7 +165,10 @@ function page_head(
echo "<body>";
}
display_cvs_versions();
project_banner($title, $prefix);
show_login_info();
}
}

View File

@ -40,11 +40,7 @@ function project_banner($title, $prefix) {
// Put your project title and logo here
// If you include any links, prepend URL with $prefix
echo "
<p>
<div class=\"page_title\">$title</div>
<p>
";
echo "<div class=\"page_title\">$title</div>";
}
function project_footer($show_return, $show_date, $prefix) {

View File

@ -26,6 +26,8 @@ $user = get_logged_in_user();
if ($user) {
check_tokens($user->authenticator);
clear_cookie('auth');
$g_logged_in_user = null;
header("Location: index.php");
page_head("Logged out");
echo "You are now logged out";
page_tail();

View File

@ -98,6 +98,14 @@ include 'schedulers.txt';
echo "
</head><body>
<div class=page_title>".PROJECT."</div>
";
if (!$stopped) {
get_logged_in_user(false);
show_login_info();
}
echo "
<table cellpadding=\"8\" cellspacing=\"4\" class=bordered>
<tr><td rowspan=\"2\" valign=\"top\" width=\"40%\">
";