Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registration impossible with Custom Profile Field using regex #2875

Closed
euantorano opened this issue Oct 16, 2017 · 1 comment
Closed

Registration impossible with Custom Profile Field using regex #2875

euantorano opened this issue Oct 16, 2017 · 1 comment
Labels
b:1.8 Branch: 1.8.x s:resolved Status: Resolved. Solution implemented or scheduled t:bug Type: Bug. An issue causing error / flaw / malfunction
Milestone

Comments

@euantorano
Copy link
Member

euantorano commented Oct 16, 2017

Every now and then we got informed by users not being able to register because of a some Custom Profile Fields on our registration page (we use 2 additional fields). Error message: 'You did not enter a valid value for the "Shop Code" field. Please enter a valid value before continuing.'

None of our custom fields were ticked 'required' so we finally decided to pull them from our registration page just in case.
You can imagine our disbelief when we realized, when we got yet another email that registration would be impossible because of said custom field still being 'required', yet not even being displayed.

Since this wasn't true for the other field, I tried to find a pattern and I think I found it:

  • Custom profile field 1 ('required' not ticked): uses regex with [a-zA-Z] -> unintentionally 'required'
  • Custom profile field 2 ('required' not ticked): does not use regex -> works as advertised as not being 'required'

Immediately after deleting the regex of Custom Profile Field 1, everything was working fine again!
My guess would be, that the system checks for letters in regex Custom Field and therefore rejects an empty field?
I mean it mages sense regarding the regex, but why is a NULL entry being parset at all?
And if the field isnt enabled on the registration page, this is even more dangerous imho.

Original thread: Registration impossible with Custom Profile Field using regex

@euantorano euantorano added b:1.8 Branch: 1.8.x t:bug Type: Bug. An issue causing error / flaw / malfunction s:confirmed Status: Confirmed. Retested and found the issue exists labels Oct 16, 2017
@euantorano
Copy link
Member Author

euantorano commented Oct 16, 2017

@Shade- Commented the following in the original thread:

Hi sicut, sorry for the late reply. I can confirm this issue, however I don't know if it's intended behavior or not. The patch would be extremely simple:

inc/datahandlers/user.php, line 575:

if(!empty($profilefield['regex']) && !preg_match("#".$profilefield['regex']."#i", $profile_fields[$field])) 

Replace with:

if(!empty($profilefield['regex']) && !empty($profile_fields[$field]) && !preg_match("#".$profilefield['regex']."#i", $profile_fields[$field])) 

I'd perhaps not use that solution from and would instead check if the field is set to be displayed, and if not skip all checking for the field's value. If it's hidden, it's obviously not going to be filled in.

Eldenroot added a commit to Eldenroot/mybb that referenced this issue Oct 16, 2017
All credits go to @shade
@Eldenroot Eldenroot mentioned this issue Oct 16, 2017
euantorano pushed a commit that referenced this issue Oct 17, 2017
All credits go to @shade
@euantorano euantorano added s:resolved Status: Resolved. Solution implemented or scheduled and removed s:confirmed Status: Confirmed. Retested and found the issue exists labels Oct 17, 2017
@Starpaul20 Starpaul20 added this to the 1.8.13 milestone Oct 17, 2017
euantorano pushed a commit to euantorano/mybb that referenced this issue Oct 25, 2017
Eldenroot added a commit to Eldenroot/mybb that referenced this issue May 8, 2018
All credits go to @shade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
b:1.8 Branch: 1.8.x s:resolved Status: Resolved. Solution implemented or scheduled t:bug Type: Bug. An issue causing error / flaw / malfunction
Projects
None yet
Development

No branches or pull requests

2 participants