-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Fetch security settings from the registry instead of portal properties #22
Conversation
This fixes the issue when adding a new user with an uppercase email. plone/Products.CMFPlone#261
To make the existing doctests pass, I needed to do some changes, which I'm not sure about:
|
@jcerjak Is this pull request needed in order to make the security panel stuff work? |
@jcerjak Just a small note on this: I'm working on moving tests to plone.app.testing, so the less you have to change them the less trouble I will have merging it later on :) |
Conflicts: plone/app/users/browser/register.py
Property "validate_email" was replaced by the "enable_user_pwd_choice" setting in the registry. #216
Regarding 1.) from #22 (comment) : 'Email' should be displayed instead of 'Login Name', if use_email_as_login is enabled. The problem is off course that the setting in login_form.cpt is read from site properties instead of the registry. @tisto , is there a recommended way to fetch the settings from the registry inside a skin template? Or should I just wait for the login forms to be converted to z3cform as well? Not sure what's the status of plone.login though. |
Waiting for plone.login would seem the sensible move, from what I've seen of it. |
I've checked 2.) and 3.) from #22 (comment) , here we have two issues:
Since login upgrade is not listed as a blocker for Plone 5 (see plone/Products.CMFPlone#184), we should probably fix this instead of waiting for plone.login? |
Branch: refs/heads/master Date: 2015-01-26T19:54:27+01:00 Author: Jure Cerjak (jcerjak) <[email protected]> Commit: plone/plone.app.users@5f96023 fix doctests, security settings are now properly read from the registry This reverts some of the changes done in fd8a29812598df320637a03588cf0c7599d2a9e7 See also plone/plone.app.users#22 Files changed: M plone/app/users/tests/duplicate_email.rst M plone/app/users/tests/email_login.rst M plone/app/users/tests/flexible_user_registration.rst diff --git a/plone/app/users/tests/duplicate_email.rst b/plone/app/users/tests/duplicate_email.rst index da0e362..91b2ded 100644 --- a/plone/app/users/tests/duplicate_email.rst +++ b/plone/app/users/tests/duplicate_email.rst @@ -32,7 +32,7 @@ Login as user two: >>> browser.open('http://nohost/plone/') >>> browser.getLink('Log in').click() - >>> browser.getControl('Login Name').value = '[email protected]' + >>> browser.getControl('E-mail').value = '[email protected]' >>> browser.getControl('Password').value = 'secret' >>> browser.getControl('Log in').click() >>> 'Login failed' in browser.contents diff --git a/plone/app/users/tests/email_login.rst b/plone/app/users/tests/email_login.rst index 7766ad3..4b7c649 100644 --- a/plone/app/users/tests/email_login.rst +++ b/plone/app/users/tests/email_login.rst @@ -67,10 +67,9 @@ Fill out the form, using an odd email address that should not give problems. >>> 'Failed to create your account' in browser.contents False - We can now login. - >>> browser.getLink('Log in').click() - >>> browser.getControl('Login Name').value = '[email protected]' - >>> browser.getControl('Password').value = 'secret' + We can login immediately. + >>> 'Click the button to log in immediately.' in browser.contents + True >>> browser.getControl('Log in').click() >>> 'You are now logged in' in browser.contents True @@ -81,9 +80,10 @@ Fill out the form, using an odd email address that should not give problems. True >>> browser.getLink(url='http://nohost/plone/logout').click() - We login as manager. + We login as manager. The login form now has a different label for + the login name. >>> browser.open('http://nohost/plone/login_form') - >>> browser.getControl('Login Name').value = SITE_OWNER_NAME + >>> browser.getControl('E-mail').value = SITE_OWNER_NAME >>> browser.getControl('Password').value = SITE_OWNER_PASSWORD >>> browser.getControl('Log in').click() diff --git a/plone/app/users/tests/flexible_user_registration.rst b/plone/app/users/tests/flexible_user_registration.rst index ae58d4a..affef03 100644 --- a/plone/app/users/tests/flexible_user_registration.rst +++ b/plone/app/users/tests/flexible_user_registration.rst @@ -147,6 +147,8 @@ Check render register form in 'Use Email As Login' mode. >>> browser.getControl('Password').value = 'testpassword' >>> browser.getControl('Confirm password').value = 'testpassword' >>> browser.getControl('Register').click() + >>> browser.contents + '...Welcome!...You have been registered...' Revert email mode. Repository: plone.app.users Branch: refs/heads/master Date: 2015-02-27T07:46:59+01:00 Author: Timo Stollenwerk () <[email protected]> Commit: plone/plone.app.users@0229de2 Merge branch 'master' into plip10359-security-controlpanel Files changed: M MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in index 233d37d..6acb23e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,3 @@ -include *.txt include *.rst recursive-include docs * Repository: plone.app.users Branch: refs/heads/master Date: 2015-03-02T18:10:17+01:00 Author: Timo Stollenwerk (tisto) <[email protected]> Commit: plone/plone.app.users@6473850 Merge pull request #31 from plone/plip10359-security-controlpanel Plip 10359 - Security Control Panel migration Files changed: M plone/app/users/tests/duplicate_email.rst M plone/app/users/tests/email_login.rst M plone/app/users/tests/flexible_user_registration.rst diff --git a/plone/app/users/tests/duplicate_email.rst b/plone/app/users/tests/duplicate_email.rst index da0e362..91b2ded 100644 --- a/plone/app/users/tests/duplicate_email.rst +++ b/plone/app/users/tests/duplicate_email.rst @@ -32,7 +32,7 @@ Login as user two: >>> browser.open('http://nohost/plone/') >>> browser.getLink('Log in').click() - >>> browser.getControl('Login Name').value = '[email protected]' + >>> browser.getControl('E-mail').value = '[email protected]' >>> browser.getControl('Password').value = 'secret' >>> browser.getControl('Log in').click() >>> 'Login failed' in browser.contents diff --git a/plone/app/users/tests/email_login.rst b/plone/app/users/tests/email_login.rst index 7766ad3..4b7c649 100644 --- a/plone/app/users/tests/email_login.rst +++ b/plone/app/users/tests/email_login.rst @@ -67,10 +67,9 @@ Fill out the form, using an odd email address that should not give problems. >>> 'Failed to create your account' in browser.contents False - We can now login. - >>> browser.getLink('Log in').click() - >>> browser.getControl('Login Name').value = '[email protected]' - >>> browser.getControl('Password').value = 'secret' + We can login immediately. + >>> 'Click the button to log in immediately.' in browser.contents + True >>> browser.getControl('Log in').click() >>> 'You are now logged in' in browser.contents True @@ -81,9 +80,10 @@ Fill out the form, using an odd email address that should not give problems. True >>> browser.getLink(url='http://nohost/plone/logout').click() - We login as manager. + We login as manager. The login form now has a different label for + the login name. >>> browser.open('http://nohost/plone/login_form') - >>> browser.getControl('Login Name').value = SITE_OWNER_NAME + >>> browser.getControl('E-mail').value = SITE_OWNER_NAME >>> browser.getControl('Password').value = SITE_OWNER_PASSWORD >>> browser.getControl('Log in').click() diff --git a/plone/app/users/tests/flexible_user_registration.rst b/plone/app/users/tests/flexible_user_registration.rst index ae58d4a..affef03 100644 --- a/plone/app/users/tests/flexible_user_registration.rst +++ b/plone/app/users/tests/flexible_user_registration.rst @@ -147,6 +147,8 @@ Check render register form in 'Use Email As Login' mode. >>> browser.getControl('Password').value = 'testpassword' >>> browser.getControl('Confirm password').value = 'testpassword' >>> browser.getControl('Register').click() + >>> browser.contents + '...Welcome!...You have been registered...' Revert email mode.
All security settings are now looked up from the plone registry instead of portal properties. This work is related to plone/Products.CMFPlone#216 .
Additionally, some of the security related tests from plone.app.controlpanel [1] were converted to unit/integration tests and moved to this package, since they were basically testing the
@@new-user
form with generate_user_id and generate_login_name methods, based on the security settings in the registry. So I think the various cases are better tested here, while the more general browser tests for the security panel will be implemented as robot tests in CMFPlone, where the security panel will be moved.This PR also contains a fix for plone/Products.CMFPlone#261 , discovered when adding additional tests.
[1] https://github.com/plone/plone.app.controlpanel/blob/master/plone/app/controlpanel/tests/security.txt