Fixed Profile email change validation

Status
Not open for further replies.

Oakley

Network license
Beta tester
Joined
Feb 27, 2017
Messages
267
Likes
60
Points
78
#1
In Settings --> User there is a "Require email confirmation" setting that asks for users to validate their email address on sign up. This works fine on sign up.

However, if a member subsequently changes their email address within their profile then they are asked to validate it, even if this setting is disabled.

Is that correct, or is it a bug.

It's a bit annoying because even if an admin changes their email address it still sends the user a validation email when it's not wanted.

Thanks :)
 

Rodolfo

Chevereto Guru-Guru
Staff member
Joined
Oct 7, 2008
Messages
16,163
Likes
4,189
Points
237
Location
Chevereto HQ
Website
rodolfoberrios.com
#2
app/routes/route.settings.php

Try changing this:
PHP:
$is_email_required = true;
To this:
PHP:
$is_email_required = CHV\getSetting('require_user_email_confirmation');
Does it fix the issue for you? As you may notice, the error was that $is_email_required was set to true without caring about the actual setting value.
 

Oakley

Network license
Beta tester
Joined
Feb 27, 2017
Messages
267
Likes
60
Points
78
#3
Nope, I thought that would fix it but it didn't unfortunately. :confused:
 

Rodolfo

Chevereto Guru-Guru
Staff member
Joined
Oct 7, 2008
Messages
16,163
Likes
4,189
Points
237
Location
Chevereto HQ
Website
rodolfoberrios.com
#4
app/routes/route.settings.php

Change this:
PHP:
if(!$is_error && !empty($_POST['email']) && !G\timing_safe_compare($user['email'], $_POST['email'])) {
To this:
PHP:
if(!$is_error && $is_email_required && !empty($_POST['email']) && !G\timing_safe_compare($user['email'], $_POST['email'])) {
 

Oakley

Network license
Beta tester
Joined
Feb 27, 2017
Messages
267
Likes
60
Points
78
#6
Many thanks, new file works a treat ;)
 
Status
Not open for further replies.