blob: 26fc67daa9ca87a3e3fce9fadd1d61fc296402fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
<?php
namespace mcoop;
require_once("recaptcha/autoload.php");
require_once("vendor/autoload.php");
require_once("common/config.php");
$danger_alerts = array();
$success_alerts = array();
$vattempted = false;
if (isset($_GET["un"], $_GET["vcode"])) {
$vattempted = true;
try {
$m = DBMember::load_by($db, "username", $_GET["un"]);
if ($m->validation_code == $_GET["vcode"]) {
$st = $db->conn->prepare("UPDATE members SET validated=true WHERE userid = ?");
$success = $st->execute(array($m->userid));
if ($success) {
$success_alerts[] = 'Successfully validated your email address, <a href="/">Continue</a>';
} else {
$einfo = $st->errorInfo();
error_log("mcoop: validate.php failed updating members: " . var_export($einfo, true) . " ($m->userid)");
$danger_alerts[] = "Failed to update the database to validate your email address, this is an internal error, please contact the admin";
}
} else {
$danger_alerts[] = "Unable to validate email: incorrect validation code";
}
} catch (UnknownMember $un) {
$danger_alerts[] = "Unable to validate email: no such user";
}
}
echo $twig->render("validate.tmpl", array(
"danger_alerts" => $danger_alerts,
"success_alerts" => $success_alerts,
"sess_info" => $sess_info,
"vattempted" => $vattempted
));
?>
|