Commit 42f28b54 by pupi1985

Let user input a confirmation code manually

parent 3de8dc03
...@@ -39,8 +39,9 @@ ...@@ -39,8 +39,9 @@
'category_level_none' => 'No upgrade', 'category_level_none' => 'No upgrade',
'change_email_link' => ' - ^1change email^2', 'change_email_link' => ' - ^1change email^2',
'change_password' => 'Change Password', 'change_password' => 'Change Password',
'confirm_button' => 'Confirm email address',
'confirm_complete' => 'Thank you - your email address has been confirmed', 'confirm_complete' => 'Thank you - your email address has been confirmed',
'confirm_emailed' => 'A confirmation link has been emailed to you. Please click the link to confirm your email address.', 'confirm_emailed' => 'Please click the link or input the code sent to your email address in order to confirm it.',
'confirm_required' => 'To complete your registration, please click the confirmation link that has been emailed to you, or ^1request another^2.', 'confirm_required' => 'To complete your registration, please click the confirmation link that has been emailed to you, or ^1request another^2.',
'confirm_title' => 'Email Address Confirmation', 'confirm_title' => 'Email Address Confirmation',
'confirm_wrong_log_in' => 'Code not correct - please ^1log in^2 to send a new link', 'confirm_wrong_log_in' => 'Code not correct - please ^1log in^2 to send a new link',
...@@ -111,7 +112,7 @@ ...@@ -111,7 +112,7 @@
'remember_label' => 'Remember me on this computer', 'remember_label' => 'Remember me on this computer',
'remove_avatar' => 'Remove avatar:', 'remove_avatar' => 'Remove avatar:',
'reset_code_another' => 'send another', 'reset_code_another' => 'send another',
'reset_code_emailed' => 'You have been emailed your reset code', 'reset_code_emailed' => 'You have been emailed your code',
'reset_code_label' => 'Code:', 'reset_code_label' => 'Code:',
'reset_code_wrong' => 'Code not correct', 'reset_code_wrong' => 'Code not correct',
'reset_title' => 'Reset Forgotten Password', 'reset_title' => 'Reset Forgotten Password',
......
...@@ -33,15 +33,29 @@ if (QA_FINAL_EXTERNAL_USERS) { ...@@ -33,15 +33,29 @@ if (QA_FINAL_EXTERNAL_USERS) {
// Check if we've been asked to send a new link or have a successful email confirmation // Check if we've been asked to send a new link or have a successful email confirmation
$code = trim(qa_get('c')); // trim to prevent passing in blank values to match uninitiated DB rows // Fetch the handle from POST or GET
$handle = trim(qa_get('u')); $handle = qa_post_text('username');
if (!isset($handle)) {
$handle = qa_get('u');
}
$handle = trim($handle); // if $handle is null, trim returns an empty string
// Fetch the code from POST or GET
$code = qa_post_text('code');
if (!isset($code)) {
$code = qa_get('c');
}
$code = trim($code); // if $code is null, trim returns an empty string
$loggedInUserId = qa_get_logged_in_userid(); $loggedInUserId = qa_get_logged_in_userid();
$emailConfirmationSent = false; $emailConfirmationSent = false;
$userConfirmed = false; $userConfirmed = false;
$pageError = null;
if (isset($loggedInUserId) && qa_clicked('dosendconfirm')) { // A logged in user requested to be sent a confirmation link if (isset($loggedInUserId) && qa_clicked('dosendconfirm')) { // A logged in user requested to be sent a confirmation link
if (!qa_check_form_security_code('confirm', qa_post_text('formcode'))) { if (!qa_check_form_security_code('confirm', qa_post_text('formcode'))) {
$pageerror = qa_lang_html('misc/form_security_again'); $pageError = qa_lang_html('misc/form_security_again');
} else { } else {
// For qa_send_new_confirm // For qa_send_new_confirm
require_once QA_INCLUDE_DIR . 'app/users-edit.php'; require_once QA_INCLUDE_DIR . 'app/users-edit.php';
...@@ -83,10 +97,50 @@ if (isset($loggedInUserId) && qa_clicked('dosendconfirm')) { // A logged in user ...@@ -83,10 +97,50 @@ if (isset($loggedInUserId) && qa_clicked('dosendconfirm')) { // A logged in user
$qa_content = qa_content_prepare(); $qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('users/confirm_title'); $qa_content['title'] = qa_lang_html('users/confirm_title');
$qa_content['error'] = @$pageerror; $qa_content['error'] = $pageError;
if ($emailConfirmationSent) { if ($emailConfirmationSent) {
$qa_content['success'] = qa_lang_html('users/confirm_emailed'); $qa_content['success'] = qa_lang_html('users/confirm_emailed');
$email = qa_get_logged_in_email();
$handle = qa_get_logged_in_handle();
$qa_content['form'] = array(
'tags' => 'method="post" action="' . qa_self_html() . '"',
'style' => 'tall',
'fields' => array(
'email' => array(
'label' => qa_lang_html('users/email_label'),
'value' => qa_html($email) . strtr(qa_lang_html('users/change_email_link'), array(
'^1' => '<a href="' . qa_path_html('account') . '">',
'^2' => '</a>',
)),
'type' => 'static',
),
'code' => array(
'label' => qa_lang_html('users/reset_code_label'),
'tags' => 'name="code" id="code"',
'value' => isset($code) ? qa_html($code) : null,
'note' => qa_lang_html('users/reset_code_emailed') . ' - ' .
'<a href="' . qa_path_html('confirm') . '">' . qa_lang_html('users/reset_code_another') . '</a>',
),
),
'buttons' => array(
'confirm' => array( // This button does not actually need a name attribute
'label' => qa_lang_html('users/confirm_button'),
),
),
'hidden' => array(
'formcode' => qa_get_form_security_code('confirm'),
'username' => qa_html($handle),
),
);
$qa_content['focusid'] = 'code';
} elseif ($userConfirmed) { } elseif ($userConfirmed) {
$qa_content['success'] = qa_lang_html('users/confirm_complete'); $qa_content['success'] = qa_lang_html('users/confirm_complete');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment