From 828f84cf9aa1cfd062b486a9144e357cb21d7725 Mon Sep 17 00:00:00 2001 From: scyrma Date: Tue, 20 Nov 2007 05:28:33 +0000 Subject: [PATCH] Makes it possible to confirm users using manual auth system. --- auth/manual/auth.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/auth/manual/auth.php b/auth/manual/auth.php index 6f1e7ca620..a8c469722f 100644 --- a/auth/manual/auth.php +++ b/auth/manual/auth.php @@ -119,6 +119,31 @@ class auth_plugin_manual extends auth_plugin_base { 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; + } + } + } ?> -- 2.39.5