Skip to content

Commit

Permalink
Makes it possible to confirm users using manual auth system.
Browse files Browse the repository at this point in the history
  • Loading branch information
scyrma committed Nov 20, 2007
1 parent d052434 commit 828f84c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions auth/manual/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,31 @@ function process_config($config) {
return true;
}

/**
* Confirm the new user as registered. This should normally not be used,
* but it may be necessary if the user auth_method is changed to manual
* before the user is confirmed.
*/
function user_confirm($username, $confirmsecret = null) {
$user = get_complete_user_data('username', $username);

if (!empty($user)) {
if ($user->confirmed) {
return AUTH_CONFIRM_ALREADY;
} else {
if (!set_field("user", "confirmed", 1, "id", $user->id)) {
return AUTH_CONFIRM_FAIL;
}
if (!set_field("user", "firstaccess", time(), "id", $user->id)) {
return AUTH_CONFIRM_FAIL;
}
return AUTH_CONFIRM_OK;
}
} else {
return AUTH_CONFIRM_ERROR;
}
}

}

?>

0 comments on commit 828f84c

Please sign in to comment.