2007-10-02 03:19:03 +00:00
|
|
|
<?php
|
2008-08-05 22:43:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
2014-04-24 16:41:59 +00:00
|
|
|
// Copyright (C) 2014 University of California
|
2008-08-05 22:43:14 +00:00
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2007-10-02 03:19:03 +00:00
|
|
|
|
2007-11-12 22:28:17 +00:00
|
|
|
require_once("../inc/boinc_db.inc");
|
2007-10-02 03:19:03 +00:00
|
|
|
require_once("../inc/util.inc");
|
|
|
|
require_once("../inc/email.inc");
|
|
|
|
|
|
|
|
function send_validate_email() {
|
|
|
|
global $master_url;
|
|
|
|
$user = get_logged_in_user();
|
2008-08-13 02:53:43 +00:00
|
|
|
$x2 = uniqid(rand(), true);
|
|
|
|
$user->update("signature='$x2'");
|
2007-10-02 03:19:03 +00:00
|
|
|
send_email(
|
|
|
|
$user,
|
2010-02-16 01:06:03 +00:00
|
|
|
tra("Validate BOINC email address"),
|
|
|
|
tra("Please visit the following link to validate the email address of your %1 account:", PROJECT)
|
|
|
|
."\n".$master_url."validate_email_addr.php?validate=1&u=$user->id&x=$x2"
|
2007-10-02 03:19:03 +00:00
|
|
|
);
|
2010-02-16 01:06:03 +00:00
|
|
|
page_head(tra("Validate email sent"));
|
|
|
|
echo tra("An email has been sent to %1. Visit the link it contains to validate your email address.", $user->email_addr);
|
2007-10-02 03:19:03 +00:00
|
|
|
page_tail();
|
|
|
|
}
|
|
|
|
|
|
|
|
function validate() {
|
2008-06-11 19:36:10 +00:00
|
|
|
$x = get_str("x");
|
|
|
|
$u = get_int("u");
|
2014-04-24 16:41:59 +00:00
|
|
|
$user = BoincUser::lookup_id($u);
|
2007-10-02 03:19:03 +00:00
|
|
|
if (!$user) {
|
2010-02-16 01:06:03 +00:00
|
|
|
error_page(tra("No such user."));
|
2007-10-02 03:19:03 +00:00
|
|
|
}
|
|
|
|
|
2008-08-13 02:53:43 +00:00
|
|
|
$x2 = $user->signature;
|
2007-10-02 03:19:03 +00:00
|
|
|
if ($x2 != $x) {
|
2010-02-16 01:06:03 +00:00
|
|
|
error_page(tra("Error in URL data - can't validate email address"));
|
2007-10-02 03:19:03 +00:00
|
|
|
}
|
|
|
|
|
2007-11-12 22:28:17 +00:00
|
|
|
$result = $user->update("email_validated=1");
|
2007-10-02 03:19:03 +00:00
|
|
|
if (!$result) {
|
2010-02-16 01:06:03 +00:00
|
|
|
error_page(tra("Database update failed - please try again later."));
|
2007-10-02 03:19:03 +00:00
|
|
|
}
|
|
|
|
|
2010-02-16 01:06:03 +00:00
|
|
|
page_head(tra("Validate email address"));
|
|
|
|
echo tra("The email address of your account has been validated.");
|
2007-10-02 03:19:03 +00:00
|
|
|
page_tail();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($_GET['validate']) {
|
|
|
|
validate();
|
|
|
|
} else {
|
|
|
|
send_validate_email();
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|