Closed (fixed)
Project:
User registration password
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Sep 2014 at 12:47 UTC
Updated:
10 Mar 2017 at 05:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Rob C commentedHey Chris,
Can you try the latest development release, that might fix it.
Comment #2
ouissla commentedHi Rob,
I am already using the latest version. I haven't had time to try to debug this yet but I will over the week end.
Thanks,
Comment #3
digitalclover commentedI've recently just come across this issue as well. The module script generates the custom URL, but when I go to that address on a logged out browser I get the same error. I'm currently using 7.x-1.3
Comment #4
shi99 commentedI also have the same issue. I'm currently using the latest dev version.
Comment #5
jeremylichtman commentedI'm attaching a VERY lightly tested patch that covers one specific use case.
The issue is that a user can sign up and be automatically logged in, and then immediately click on the validation link in their email.
The patch assumes that we are tracking a "registered but not yet validated" user by their having the "preauthorized user" role associated with their profile.
It checks if the role exists, and acts as if the user were not logged in if they are preauth.
I don't suggest using this in production. Just hoping to assist in moving this issue forward, as I'm encountering it as well.
Comment #6
jeremylichtman commentedBTW, the logic condition in the patch I just posted is incorrect, and it doesn't actually apply either. Again, just to hopefully point somebody in the right direction.
Comment #7
Rob C commentedAnyone experiencing this with 1.4? Else ill close this up.
Comment #8
sgorneau commentedThis is still happening for me with 7.x-1.4 and 7.x-1.x-dev with Drupal 7.39
Comment #9
sgorneau commentedIn user_registrationpassword.pages.inc on line 43 ( in "function user_registrationpassword_confirm_account()" ), why are we looking for more than one account when a single uid is being passed?
Comment #10
sgorneau commentedFor anyone wondering, I swapped out the user_load_multiple() and its $conditions for an EntityFieldQuery()
Comment #11
Rob C commentedIf you compare the code in core at user.pages.inc with user_registrationpassword.pages.inc, you might notice these look very similar. This is because we try to stay as close to core as possible.
But sgorneau, this has nothing to do with the current issue right? Or do you experience something related?
Comment #12
Sequencing.com commentedWe are experiencing this same issue. The module works fine on a clean install, but when installed on our prod site the confirmation link sent to the user is shown as used ("You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below").
We installed the patch but it didn't resolve the issue. As of now this module is unusable and multiple users reporting this same issue so elevating Priority to Critical.
Comment #13
Rob C commented"The module works fine on a clean install"
Downgrading status again, proves it's not a bug. And you first want to provide lots more details about installed modules + trace / step debug this to it's cause + if this works on a clean install, it might be you are running logintoboggan or something and these modules are just not compatible, and can't be. Please read up on how and why.
Also:
In most cases i debugged myself i found that other modules change 'access', 'status', 'login' to not be 0.
This is the reason why user_registrationpassword does not work with some modules that also influence the registration process.
That's not a bug, it's just how drupal core works + how contrib 'has to deal with this'.
My advice always is: make sure you have no other module installed that might change any of these without knowing about them in detail.
+
If we change this, drupal core will send out default register emails again. Current code prevents core from sending out the default emails. That's why we leave/set 'access', 'status', 'login' all to 0. (or we have to replace/implement a lot of code) (leading to lots of code duplication).
+
If you have that clean install, enable all modules you have on production one by one, and try to register again, then validate the user's status/created/access. All should be 0.
And a test exists for this, and it's not failing.
Hope this helps a bit.
Comment #14
pallavi_sugandhi commentedI am facing same problem, but when I disabled the LoginToboggan module its working fine.
Comment #15
roland.molnar commentedI'm facing the same problem when using user_registrationpassword with email_registration module.
Comment #16
roland.molnar commentedI found out the cause of the issue and I think that it's because of a bad API usage.
TL;DR
The module uses user_pass_rehash() in 2 places (+tests), but it's passing user's name insted of user's last login time as 3rd parameter.
According to the function's doc, the 3rd parameter is an integer, UNIX timestamp of las log in:
I am not sure if it is intended or just a mistake. The parameter name $login can be misleading.
But I think that it's a mis-use of the user_pass_rehash() function, so even if it's intended I recommend to change it to meet the spec.
I attach a patch that fixes the issue (including the test files).
This is what heppens when you use the user_registrationpassword and email_registration and set "Require a verification e-mail, but let users set their password directly on the registration form." on /admin/config/people/accounts:
1. email_registration modifies the form, it hides the username field and set a random value as default. This will be saved.
2. user_registrationpassword alters the same form's submit handler to send out the email
3. after this, email_registraion's hook_user_insert() executes and changes the username
4. When the user clicks on the activation link, the hash in the link and the hash expected by the module is different because the username has changed.
Comment #17
roland.molnar commentedSorry, I've uploaded the wrong patch file. Here is the correct one.
Comment #18
Rob C commented"I am not sure if it is intended or just a mistake. The parameter name $login can be misleading."
This is a bug, a mistake added in a3e4b75aa12c0f9e16f4b90bfdb29fd1e81acb24.
I'll accept the patch. Thank you very much for tracing this down Roland!
(also set the status to needs review to trigger testing next time please)
Comment #21
Rob C commented