function login_with_ldap($uid, $passwd, $next_url, $perm) { list($ldap_user, $error_msg) = ldap_auth($uid, $passwd); if ($error_msg) { error_page($error_msg); } $x = ldap_email_string($uid); $user = BoincUser::lookup_email_addr($x); if (!$user) { // LDAP authentication succeeded but we don't have a user record. // Create one. // $user = make_user_ldap($x, $ldap_user->name); } if (!$user) { error_page("Couldn't create user"); } Header("Location: " . url_base() . "{$next_url}"); send_cookie('auth', $user->authenticator, $perm); return; }
function email_sent_message($email_addr) { if (defined('EMAIL_FROM')) { $email_from = EMAIL_FROM; } else { $email_from = URL_BASE; } page_head("Email sent"); echo "\n Instructions have been emailed to {$email_addr}.\n <p>\n If the email doesn't arrive in a few minutes,\n your ISP may be blocking it as spam.\n In this case please contact your ISP and\n ask them to not block email from {$email_from}.\n "; } $email_addr = strtolower(post_str("email_addr")); $email_addr = sanitize_email($email_addr); if (!strlen($email_addr)) { error_page("no address given"); } $user = BoincUser::lookup_email_addr($email_addr); if (!$user) { page_head("No such user"); echo "There is no user with email address {$email_addr}. <br>\n Try reentering your email address.<p>\n "; } else { if (substr($user->authenticator, 0, 1) == 'x') { page_head("Account Currently Disabled"); echo "This account has been administratively disabled."; } else { $user->email_addr = $email_addr; $retval = send_auth_email($user); if ($retval) { email_sent_message($email_addr); } else { page_head("Email failed"); echo "Can't send email to {$user->email_addr}";
require_once "../inc/user.inc"; check_get_args(array()); $user = get_logged_in_user(); $email_addr = strtolower(post_str("email_addr")); $passwd = post_str("passwd", true); page_head(tra("Change email address of account")); if (!is_valid_email_addr($email_addr)) { echo tra("New email address '%1' is invalid.", $email_addr); } else { if (is_banned_email_addr($email_addr)) { echo tra("New email address '%1' is invalid.", $email_addr); } else { if ($email_addr == $user->email_addr) { echo tra("New email address is same as existing address. Nothing is changed."); } else { $existing = BoincUser::lookup_email_addr($email_addr); if ($existing) { echo tra("There's already an account with that email address"); } else { $passwd_hash = md5($passwd . $user->email_addr); // deal with the case where user hasn't set passwd // (i.e. passwd is account key) // if ($passwd_hash != $user->passwd_hash) { $passwd = $user->authenticator; $passwd_hash = md5($passwd . $user->email_addr); } if ($passwd_hash != $user->passwd_hash) { echo tra("Invalid password."); } else { $passwd_hash = md5($passwd . $email_addr);
function handle_team($f) { $t = parse_team($f); if (!$t) { echo "Failed to parse team\n"; return; } //print_r($t); //return; if (!valid_team($t)) { echo "Invalid team\n"; return; } echo "Processing {$t->name} {$t->user_email}\n"; $user = BoincUser::lookup_email_addr($t->user_email); $team = BoincTeam::lookup_name($t->name); if ($team) { if (!$user) { echo " team exists but user {$t->user_email} doesn't\n"; return; } if ($user->id != $team->userid) { echo " team exists but is owned by a different user\n"; return; } if ($team->seti_id) { if ($team->seti_id == $t->id) { echo " case 1\n"; update_team($t, $team, $user); // update1 case } else { echo " team exists but has wrong seti_id\n"; } } else { $team2 = lookup_team_seti_id($t->id); if ($team2) { // update1 case echo " case 2\n"; update_team($t, $team2, $user); } else { // update2 case echo " case 3\n"; update_team($t, $team, $user); } } } else { $team = lookup_team_seti_id($t->id); if ($team) { echo " A team with same ID but different name exists;\n"; echo " Please report this to {$t->user_email};\n"; } else { echo " Adding team\n"; insert_case($t, $user); } } }