From: Roland Häder Date: Sun, 22 Aug 2010 13:54:30 +0000 (+0000) Subject: Moved resending of user confirmation link to ext-user X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cd85456cecbbe338df3b6bd2ca556f93f5a424ed;p=mailer.git Moved resending of user confirmation link to ext-user --- diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index e460fa7985..21a0837eb8 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -86,7 +86,7 @@ ./inc/libs/user_functions.php:327: // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content); ./inc/libs/user_functions.php:347: // @TODO Make this filter working: $url = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON)); ./inc/libs/user_functions.php:423: // @TODO We should try to rewrite this to fetchUserData() somehow -./inc/libs/user_functions.php:609: // @TODO Try to rewrite the following unset() +./inc/libs/user_functions.php:611: // @TODO Try to rewrite the following unset() ./inc/libs/yoomedia_functions.php:116: $response = YOOMEDIA_QUERY_API('out_textmail.php', true); // @TODO Ask Yoo!Media for test script ./inc/load_config.php:77: // @TODO Rewrite them to avoid this else block ./inc/loader/load_cache-extension.php:13: * @TODO Rewrite this whole file to load_cache-extensions.php * diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index b568c879ad..62daf7d8b2 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -649,6 +649,40 @@ LIMIT 1", loadTemplate('admin_settings_saved', false, $content['message']); } +// Does resend the user's confirmation link for given email address +function doResendUserConfirmationLink ($email) { + // Confirmation link requested + if (fetchUserData($email, 'email')) { + // Email address found + $content = getUserDataArray(); + + // Detect status + switch ($content['status']) { + case 'UNCONFIRMED': // Account not confirmed + // Load email template + $message = loadEmailTemplate('guest_request_confirm', array('hash' => $content['user_hash']), $content['userid']); + + // Send email + sendEmail($email, '{--REQUEST_CONFIRM_LINK_SUBJECT--}', $message); + + // And set message + $content['message'] = '{--CONFIRM_LINK_SENT--}'; + break; + + case 'CONFIRMED': // Account already confirmed + $content['message'] = '{--LOGIN_ID_CONFIRMED--}'; + break; + + case 'LOCKED': // Account is locked + $content['message'] = '{--LOGIN_ID_LOCKED--}'; + break; + } // END - switch + } else { + // Email address not registered + $content['message'] = '{--EMAIL_404--}'; + } +} + // Expression call-back function for fetching user data function doExpressionUser ($data) { // Use current userid by default diff --git a/inc/modules/guest/what-confirm.php b/inc/modules/guest/what-confirm.php index a3f4e86175..1280dd3088 100644 --- a/inc/modules/guest/what-confirm.php +++ b/inc/modules/guest/what-confirm.php @@ -54,39 +54,8 @@ if (isGetRequestParameterSet('hash')) { // Do user account confirmation doConfirmUserAccount(getRequestParameter('hash')); } elseif ((isFormSent()) && (isPostRequestParameterSet('email'))) { - // Confirmation link requested 0 1 2 - if (fetchUserData(postRequestParameter('email'), 'email')) { - // Email address found - $content = getUserDataArray(); - - // Detect status - switch ($content['status']) { - case 'UNCONFIRMED': // Account not confirmed - // Load email template - $message = loadEmailTemplate('guest_request_confirm', array('hash' => $content['user_hash']), $content['userid']); - - // Send email - sendEmail(postRequestParameter('email'), '{--REQUEST_CONFIRM_LINK_SUBJECT--}', $message); - - // And set message - $content['message'] = '{--CONFIRM_LINK_SENT--}'; - break; - - case 'CONFIRMED': // Account already confirmed - $content['message'] = '{--LOGIN_ID_CONFIRMED--}'; - break; - - case 'LOCKED': // Account is locked - $content['message'] = '{--LOGIN_ID_LOCKED--}'; - break; - } // END - switch - } else { - // Email address not registered - $content['message'] = '{--EMAIL_404--}'; - } - - // Load template - loadTemplate('admin_settings_saved', false, $content['message']); + // Resend confirmation link + doResendUserConfirmationLink(postRequestParameter('email')); } else { // No hash found, the guest may want to enter his email address to re-get his confirmation link? loadTemplate('guest_confirm_link');