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

Acceptance test failures related to add user by email address #54

Closed
phil-davis opened this issue Sep 12, 2018 · 6 comments
Closed

Acceptance test failures related to add user by email address #54

phil-davis opened this issue Sep 12, 2018 · 6 comments

Comments

@phil-davis
Copy link
Contributor

phil-davis commented Sep 12, 2018

Some acceptance tests are failing. See example in PR #53 and its linked drone results https://drone.owncloud.com/owncloud/encryption/205

e.g. with user-keys, mysql, daily-stable10-qa PHP 5.6

 Scenario Outline: user sets his own password after being created with an Email address only # /var/www/owncloud/tests/acceptance/features/webUIManageUsersGroups/addUsers.feature:61
      | guiusr1  | simple user-name      |
        Failed asserting that '
        --_=_swift_v4_1536720919_49c4e00e6c370c3071e621950db80cd9_=_
        Content-Type: text/plain; charset=utf-8
        Content-Transfer-Encoding: quoted-printable
        
        Hey there,
        
        just letting you know that you now have an ownCloud account.
        
        Your username: guiusr1
        Access it: http://server/settings/users/setpassword/form/761553510911067257740/guiusr1
        
        Cheers!
        	--
        ownCloud - A safe home for all your data
        https://owncloud.org
        
        --_=_swift_v4_1536720919_49c4e00e6c370c3071e621950db80cd9_=_
        Content-Type: text/html; charset=utf-8
        Content-Transfer-Encoding: quoted-printable
        
        <table cellspacing="0" cellpadding="0" border="0" width="100%">
        	<tr><td>
        			<table cellspacing="0" cellpadding="0" border="0" width="600px">
        				<tr>
        					<td bgcolor="#1d2d44" width="20px">&nbsp;</td>
        					<td bgcolor="#1d2d44">
        						<img src="http://server/core/img/logo-mail.gif" alt="ownCloud"/>
        					</td>
        				</tr>
        				<tr><td colspan="2">&nbsp;</td></tr>
        				<tr>
        					<td width="20px">&nbsp;</td>
        					<td style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">
        						Hey there,<br><br>just letting you know that you now have an ownCloud account.<br><br>Your username: guiusr1<br>Please set the password by accessing it: <a href="http://server/settings/users/setpassword/form/761553510911067257740/guiusr1">Here</a><br><br>Cheers!					</td>
        				</tr>
        				<tr><td colspan="2">&nbsp;</td></tr>
        				<tr>
        					<td width="20px">&nbsp;</td>
        					<td style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">--<br>
        						ownCloud -
        						A safe home for all your data						<br><a href="https://owncloud.org">https://owncloud.org</a>
        					</td>
        				</tr>
        				<tr>
        					<td colspan="2">&nbsp;</td>
        				</tr>
        			</table>
        		</td></tr>
        </table>
        
        
        --_=_swift_v4_1536720919_49c4e00e6c370c3071e621950db80cd9_=_--
        ' contains "Password changed successfully".

 Scenario: sets-password-token cannot be used twice # /var/www/owncloud/tests/acceptance/features/webUIManageUsersGroups/addUsers.feature:102
    When the administrator creates a user with the name "guiusr1" and the email "guiusr1@owncloud" without a password using the webUI # WebUIUsersContext::theAdminCreatesAUserUsingWithoutAPasswordTheWebUI()
    And the administrator logs out of the webUI                                                                                       # WebUIGeneralContext::theUserLogsOutOfTheWebUI()
    And the user follows the password set link received by "guiusr1@owncloud" using the webUI                                         # WebUILoginContext::theUserFollowsThePasswordSetLinkReceivedByEmail()
INFORMATION: timed out waiting for outstanding ajax calls
    And the user sets the password to "newpassword" using the webUI                                                                   # WebUILoginContext::theUserResetsThePasswordToUsingTheWebui()
      │ INFORMATION: timed out waiting for outstanding ajax calls
    And the user follows the password set link received by "guiusr1@owncloud" in Email number 2 using the webUI                       # WebUILoginContext::theUserFollowsThePasswordSetLinkReceivedByEmail()
      exception 'Exception' with message 'Could not find the email to the address: guiusr1@owncloud' in /var/www/owncloud/tests/TestHelpers/EmailHelper.php:92

--- Failed scenarios:

    /var/www/owncloud/tests/acceptance/features/webUIManageUsersGroups/addUsers.feature:74
    /var/www/owncloud/tests/acceptance/features/webUIManageUsersGroups/addUsers.feature:75
    /var/www/owncloud/tests/acceptance/features/webUIManageUsersGroups/addUsers.feature:102
    /var/www/owncloud/tests/acceptance/features/webUIManageUsersGroups/addUsers.feature:111

@phil-davis
Copy link
Contributor Author

The fails seem to be for user-key encryption test jobs. So maybe there is a real problem here with the user creation workflow when user-key encryption is enabled.

@individual-it
Copy link
Member

looks like the password was never set.
@sharidas is this new function suppose to work with encryption?

@individual-it
Copy link
Member

{"reqId":"78DwgisbfHaIuo3eLrrV","level":3,"time":"2018-09-12T02:55:22+00:00","remoteAddr":"192.168.192.3","user":"--","app":"no app in context","method":"POST","url":"\/setpassword\/761553510911067257740\/guiusr1","message":"Exception: {\"Exception\":\"OCA\\\\Encryption\\\\Exceptions\\\\PrivateKeyMissingException\",\"Message\":\"Private Key missing for user: please try to log-out and log-in again\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/apps\\\/encryption\\\/lib\\\/Hooks\\\/UserHooks.php(251): OCA\\\\Encryption\\\\Session->getPrivateKey()\\n#1 [internal function]: OCA\\\\Encryption\\\\Hooks\\\\UserHooks->setPassphrase(Array)\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/legacy\\\/hook.php(105): call_user_func(Array, Array)\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Server.php(353): OC_Hook::emit('OC_User', 'post_setPasswor...', Array)\\n#4 [internal function]: OC\\\\Server->OC\\\\{closure}(Object(OC\\\\User\\\\User), 'newpassword', NULL)\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Hooks\\\/EmitterTrait.php(99): call_user_func_array(Object(Closure), Array)\\n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Hooks\\\/PublicEmitter.php(33): OC\\\\Hooks\\\\BasicEmitter->emit('\\\\\\\\OC\\\\\\\\User', 'postSetPassword', Array)\\n#7 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/User\\\/User.php(311): OC\\\\Hooks\\\\PublicEmitter->emit('\\\\\\\\OC\\\\\\\\User', 'postSetPassword', Array)\\n#8 \\\/var\\\/www\\\/owncloud\\\/lib\\\/public\\\/Events\\\/EventEmitterTrait.php(50): OC\\\\User\\\\User->OC\\\\User\\\\{closure}(Array)\\n#9 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/User\\\/User.php(322): OC\\\\User\\\\User->emittingCall(Object(Closure), Array, 'user', 'setpassword')\\n#10 \\\/var\\\/www\\\/owncloud\\\/settings\\\/Controller\\\/UsersController.php(659): OC\\\\User\\\\User->setPassword('newpassword')\\n#11 [internal function]: OC\\\\Settings\\\\Controller\\\\UsersController->setPassword('761553510911067...', 'guiusr1', 'newpassword')\\n#12 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(153): call_user_func_array(Array, Array)\\n#13 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(85): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController(Object(OC\\\\Settings\\\\Controller\\\\UsersController), 'setPassword')\\n#14 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/App.php(100): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch(Object(OC\\\\Settings\\\\Controller\\\\UsersController), 'setPassword')\\n#15 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(46): OC\\\\AppFramework\\\\App::main('UsersController', 'setPassword', Object(OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer), Array)\\n#16 [internal function]: OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke(Array)\\n#17 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Route\\\/Router.php(342): call_user_func(Object(OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler), Array)\\n#18 \\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(909): OC\\\\Route\\\\Router->match('\\\/setpassword\\\/76...')\\n#19 \\\/var\\\/www\\\/owncloud\\\/index.php(54): OC::handleRequest()\\n#20 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/encryption\\\/lib\\\/Session.php\",\"Line\":81}"}

@sharidas
Copy link
Contributor

The problem is caused here at https://github.com/owncloud/core/blob/stable10/apps/encryption/lib/Hooks/UserHooks.php#L250. The call to this code arrives from https://github.com/owncloud/core/blob/stable10/lib/private/User/User.php#L311.

So it needs a user session. The failure happens when a user tries to set the password in a browser where no session is available. When logged in as admin user and try to open another tab by opening the link to set password, it works. But this is just a work around :(

@PVince81 PVince81 added this to the QA milestone Sep 12, 2018
@PVince81
Copy link
Contributor

@sharidas not necessarily needing a session. Maybe add a check whether the session exists or not. It's only there for the case where the user changes an existing password.

@PVince81
Copy link
Contributor

I'd like to have this in 10.0.10 as it breaks user creation with the new flow. As discussed with @sharidas the fix is rather straightforward so I think it will make it in. Setting to p2 then.

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

No branches or pull requests

5 participants