Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
42f28b54
Commit
42f28b54
authored
Nov 29, 2016
by
pupi1985
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let user input a confirmation code manually
parent
3de8dc03
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
6 deletions
+61
-6
qa-lang-users.php
qa-include/lang/qa-lang-users.php
+3
-2
confirm.php
qa-include/pages/confirm.php
+58
-4
No files found.
qa-include/lang/qa-lang-users.php
View file @
42f28b54
...
@@ -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'
,
...
...
qa-include/pages/confirm.php
View file @
42f28b54
...
@@ -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'
)))
{
$page
e
rror
=
qa_lang_html
(
'misc/form_security_again'
);
$page
E
rror
=
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'
]
=
@
$pagee
rror
;
$qa_content
[
'error'
]
=
$pageE
rror
;
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'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment