Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I think it makes sense to log a user in after they create an account, if account does not require approval. Since the point of this module is to make creating an account an easy... I've patched this on my own site and will upload if there's interest.
Comment | File | Size | Author |
---|---|---|---|
#17 | 377262_stop_forced_login_more_tests_17_d6.patch | 2.11 KB | greggles |
#15 | 377262_stop_forced_login_more_tests_14.patch | 1.68 KB | greggles |
#13 | 377262_user_login_finalize_more_tests.patch | 1.51 KB | greggles |
#2 | email_registration-login.patch | 766 bytes | heydemo |
Comments
Comment #1
rhughes CreditAttribution: rhughes commentedIf you could do that, that would be great.
I am also looking for a really simple login process.
I am a Drupal newbie so if you could provide any information as to where and how to patch that would be awesome.
Comment #2
heydemo CreditAttribution: heydemo commentedOk, here's the patch. So basically you would put this in your email_registration directory and type:
patch < email_registration-login.patch
Remember to back up before applying patches. And read this for more info:
http://drupal.org/patch/apply
Comment #3
heydemo CreditAttribution: heydemo commentedComment #4
Christopher Herberte CreditAttribution: Christopher Herberte commentedDoes this patch provide the existing, built-in functionality for logging users in immediately after registration at admin/user/settings ?
... "With it unchecked, users will be logged in immediately upon registering, and may select their own passwords during registration."
Comment #5
mdcook CreditAttribution: mdcook commentedPatch worked. Thank you!
Comment #6
heydemo CreditAttribution: heydemo commentedChris, not sure I understand. As email registration module stands, user is *logged out* after registering. This patch logs user in, as long as email verification is not required. It is as simple as setting the global user object to the account parameter of hook_user.
Comment #7
gregglesI looked through the code in user.module for a little while and I'm not sure why we should have to do this in email_registration.module instead of just letting user.module "do the right thing." But, I'm very new to email_registration module so perhaps it is my lack of knowledge.
@heydemo - could you explain this a bit more? I agree that we should be respecting that core setting.
Comment #8
Christopher Herberte CreditAttribution: Christopher Herberte commentedI can confirm that without this patch email_registration will not work as it should with "Require e-mail verification when a visitor creates an account" unticked.
Comment #9
Christopher Herberte CreditAttribution: Christopher Herberte commentedCommitted to 6.x.1.x-dev
Comment #10
ericbroder CreditAttribution: ericbroder commentedSorry to open up an old issue, but I think we may be missing an important step here.
Don't we also need to call either user_external_login or user_authenticate_finalize? Otherwise the auto-login function in this module will not properly invoke the login functionality happening in other modules.
For example, I'm having a conflict with Secure Pages Hijack Prevention module. SPHP contains the following code:
The login hook is not getting invoked by Email Registration module upon auto-login, as it should.
In my particular use case I'm creating a new user by calling user_save in my custom module, so I'm not using the usual user/register form.
Comment #11
gregglesYep, makes sense to me. Does this also affect 7.x?
Comment #12
gregglesYes, it appears it does so let's fix it there first and then backport.
Comment #13
gregglesuser_external_login is for modules that authenticate against another system, so I think that user_authenticate_finalize is the right function to use here.
user_authenticate_finalize is user_login_finalize in D7.
Attached is a patch to add it to d7 and add some tests to be more confident that it works.
Comment #14
gregglesI actually don't see why this code is needed at all. I removed it all and left in the new tests and it all still works.
Removing this code should help with issues like #738134: Conflict with LoginToboggan submit handler.
Comment #15
gregglesComment #16
gregglesNow committed to 7.x-1.x http://drupalcode.org/project/email_registration.git/commit/1c1c453
Comment #17
gregglesHere's a re-roll for D6.
Comment #18
gregglesTests pass - committed to 6.x-1.x as well http://drupalcode.org/project/email_registration.git/commit/168a8d2