Skip to content

Conversation

@SharkyKZ
Copy link
Contributor

@SharkyKZ SharkyKZ commented May 13, 2018

Pull Request for Issue # .

Summary of Changes

This PR adds user email domain restrictions. This is an alternative to #20164 with more flexibility added.

Testing Instructions

Apply patch.
Go to Users configuration.
In Email Domain Options add some rules.

a) Try to register with disallowed email.
b) Try to register with an email that isn't disallowed.
c) Try to change email in user profile to a disallowed email.
d) Try to change email in user profile to an allowed email.
e) Remove all rules and try to register again.

Expected result

a) Registration fails.
b) Registration successful.
c) Changes not saved.
d) Changes saved.
e) Registration successful.

Documentation Changes Required

Document the new option.
Document validDomains attribute usage in EmailRule.
Document message property in FormRule.

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-staging labels May 13, 2018
@Quy
Copy link
Contributor

Quy commented May 13, 2018

On the backend, text not translated JGLOBAL_EMAIL_DOMAIN_NOT_ALLOWED.

@SharkyKZ
Copy link
Contributor Author

Added strings. Thanks.

Copy link
Contributor

@brianteeman brianteeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely we have a string for this already

@Quy
Copy link
Contributor

Quy commented May 13, 2018

For the Rule, how about making it a radio type with the red/green switcher instead of a list?

{
if ($domain->rule == 0)
{
$allowed = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put a break here since there is no point in processing additional rules if any.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this would prevent other rules from overwriting the first matched rule.

COM_USERS_CONFIG_FIELD_CAPTCHA_LABEL="Captcha"
COM_USERS_CONFIG_FIELD_CHANGEUSERNAME_DESC="Allow users to change their Username when editing their profile."
COM_USERS_CONFIG_FIELD_CHANGEUSERNAME_LABEL="Change Username"
COM_USERS_CONFIG_FIELD_DOMAIN_NAME_DESC="Enter a domain name. Wildcards (*) are supported. For example:<br /><b>*</b> allows or disallows all domains;<br /><b>*.com</b> allows or disallows all .com domains;<br /><b>*.joomla.org</b> allows or disallows all joomla.org subdomains."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use strong instead of b

JGLOBAL_EDIT_ITEM="Edit item"
JGLOBAL_EDIT_PREFERENCES="Edit Preferences"
JGLOBAL_EMAIL="Email"
JGLOBAL_EMAIL_DOMAIN_NOT_ALLOWED="The email domain <b>%s</b> is not allowed. Please enter another email address."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment

JGLOBAL_EDIT="Edit"
JGLOBAL_EDIT_TITLE="Edit article"
JGLOBAL_EMAIL="Email"
JGLOBAL_EMAIL_DOMAIN_NOT_ALLOWED="The email domain <b>%s</b> is not allowed. Please enter another email address."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment

@SharkyKZ
Copy link
Contributor Author

@brianteeman previously this was used:

COM_USERS_PROFILE_EMAIL1_MESSAGE="The email address you entered is already in use or invalid. Please enter another email address."

Although we could update it to read "The email address you entered is already in use, not allowed or invalid. Please enter another email address.", a change in this PR allows to output a different message based on which part of validation fails. This is more user friendly, IMO.

@SharkyKZ
Copy link
Contributor Author

SharkyKZ commented Jul 2, 2018

All domains are allowed by default and rules are executed in order, starting at the top. To allow only specific domain, you must first block all other domains. So to allow only *.example.org need to swap your rules:

* : Disallowed
*.example.org : Allowed

@infograf768
Copy link
Member

re-started travis

@SharkyKZ
Copy link
Contributor Author

SharkyKZ commented Jul 3, 2018

Travis failure is correct. This needs new unit tests.

@ReLater
Copy link
Contributor

ReLater commented Jul 3, 2018

@SharkyKZ

All domains are allowed by default and rules are executed in order, starting at the top. To allow only specific domain, you must first block all other domains. So to allow only *.example.org need to swap your rules:

That's why I've asked because I've tested both orderings and could not register with example.org.

03-07-_2018_12-13-10

03-07-_2018_12-06-00

03-07-_2018_12-07-09

I tested also without captcha => same result.

@ReLater
Copy link
Contributor

ReLater commented Jul 3, 2018

Tested also unsuccessfully without dot, just *example.org

@SharkyKZ
Copy link
Contributor Author

SharkyKZ commented Jul 3, 2018

Yes, wildcards currently work on full segments only as per comments #20383 (comment). But this can be improved. Any suggestions welcome (especially for fixing tests).

@ReLater
Copy link
Contributor

ReLater commented Jul 3, 2018

To clarify: I could not allow [email protected]. All tests unsuccessful. Makes no difference if my rule is with (#20383 (comment)) or without dot.

Joomla 3.8.11-dev nightly of yesterday.

@infograf768
Copy link
Member

@ReLater
I do not confirm your findings here. For me it works as intended. (Latest staging).

@ReLater
Copy link
Contributor

ReLater commented Jul 4, 2018

@infograf768

I do not confirm your findings here. For me it works as intended. (Latest staging).

Thank you. Maybe I have to install a new staging. I'm using the Joomla upload/update feature for a longer time now with nightly update packages for 3.8.x. Or maybe a conflict with an installed 3rd extension. I will see.

@ReLater
Copy link
Contributor

ReLater commented Jul 4, 2018

Forget this comment:

After a new installation of staging nightly build of today I have the same unsuccessful results like in comment #20383 (comment)
Could you please have a look on the settings there?

I've tried it also with other rules/domains than *.example.org.

* : Disallowed 
*.example.org : Allowed

PHP 7.1 and 7.2

PHP Built On | Linux dd1620 3.13.0-151-generic #201-Ubuntu SMP Wed May 30 14:22:13 UTC 2018 x86_64
Database Type | mysql
Database Version | 5.5.58-nmm1-log
Database Collation | utf8_general_ci
Database Connection Collation | utf8mb4_general_ci
PHP Version | 7.2.1
Web Server | Apache
WebServer to PHP Interface | fpm-fcgi
Joomla! Version | Joomla! 3.8.11-dev Development [ Amani ] 26-June-2018 15:45 GMT
Joomla! Platform Version | Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0

@ReLater
Copy link
Contributor

ReLater commented Jul 4, 2018

After 2 coffees => "Stupid me!"

For allowed email [email protected] one have to set

* : Disallowed 
example.org : Allowed

@ReLater
Copy link
Contributor

ReLater commented Jul 4, 2018

I have tested this item ✅ successfully on c7a8282


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20383.

@ka3media
Copy link

ka3media commented Sep 8, 2018

I have tested this item ✅ successfully on c7a8282

Tested on J3.9 alpha

Applied the patch and checked various rulesets and rule sorting to check if sorting has the expected behavior.

Works for me


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20383.

@ghost
Copy link

ghost commented Sep 8, 2018

Ready to Commit after 4 successful tests.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Sep 8, 2018
@hamby
Copy link

hamby commented Sep 8, 2018

"Testing Instructions" from above a) - e) was tested successfully

But i found a other problem: Ording Dependence Problem

image

--> Registration of example.us is possible

image

--> Registration of example.us is NOT possible

@ka3media
Copy link

ka3media commented Sep 8, 2018

But that's the expected behavior... if the last action is "disallow all" than all is disallowed

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Sep 8, 2018
@PhilETaylor

This comment was marked as abuse.

@mbabker
Copy link
Contributor

mbabker commented Sep 9, 2018

Fixed via 1ddb06d

@810
Copy link
Contributor

810 commented Oct 31, 2018

Any option to disable this feature?

Because I can't edit a user option now:
image

@Quy
Copy link
Contributor

Quy commented Oct 31, 2018

Try deleting the row.

@810
Copy link
Contributor

810 commented Oct 31, 2018

nothing happend when I click on -
IE11.1001.18267.0

@810
Copy link
Contributor

810 commented Oct 31, 2018

ie11
image

Edge:
image

Looks like html issue

@Quy
Copy link
Contributor

Quy commented Oct 31, 2018

Strange. I am able to delete so there are no entries.

email-domain-options

@810
Copy link
Contributor

810 commented Oct 31, 2018

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Language Change This is for Translators

Projects

None yet

Development

Successfully merging this pull request may close these issues.