$user = get_complete_user_data('username', $username);
if (!empty($user)) {
- if ($user->confirmed) {
- return AUTH_CONFIRM_ALREADY;
-
- } else if ($user->auth != $this->authtype) {
+ if ($user->auth != $this->authtype) {
return AUTH_CONFIRM_ERROR;
+ } else if ($user->secret == $confirmsecret && $user->confirmed) {
+ return AUTH_CONFIRM_ALREADY;
+
} else if ($user->secret == $confirmsecret) { // They have provided the secret key to get in
$DB->set_field("user", "confirmed", 1, array("id"=>$user->id));
return AUTH_CONFIRM_OK;
$user = get_complete_user_data('username', $username);
if (!empty($user)) {
- if ($user->confirmed) {
- return AUTH_CONFIRM_ALREADY;
-
- } else if ($user->auth != $this->authtype) {
+ if ($user->auth != $this->authtype) {
return AUTH_CONFIRM_ERROR;
+ } else if ($user->secret == $confirmsecret && $user->confirmed) {
+ return AUTH_CONFIRM_ALREADY;
+
} else if ($user->secret == $confirmsecret) { // They have provided the secret key to get in
if (!$this->user_activate($username)) {
return AUTH_CONFIRM_FAIL;
$PAGE->set_heading($COURSE->fullname);
echo $OUTPUT->header();
echo $OUTPUT->box_start('generalbox centerpara boxwidthnormal boxaligncenter');
- echo "<h3>".get_string("thanks").", ". fullname($user) . "</h3>\n";
echo "<p>".get_string("alreadyconfirmed")."</p>\n";
echo $OUTPUT->single_button("$CFG->wwwroot/course/", get_string('courses'));
echo $OUTPUT->box_end();