-
-
Save kevincupp/1571916 to your computer and use it in GitHub Desktop.
| diff --git a/system/expressionengine/libraries/Auth.php b/system/expressionengine/libraries/Auth.php | |
| index 82c0bfb..992bc6c 100644 | |
| --- a/system/expressionengine/libraries/Auth.php | |
| +++ b/system/expressionengine/libraries/Auth.php | |
| @@ -572,6 +572,7 @@ class Auth_result { | |
| private $member; | |
| private $session_id; | |
| private $remember_me = 0; | |
| + private $anon = FALSE; | |
| private $EE; | |
| /** | |
| @@ -702,6 +703,19 @@ class Auth_result { | |
| { | |
| $this->remember_me = $expire; | |
| } | |
| + | |
| + // -------------------------------------------------------------------- | |
| + | |
| + /** | |
| + * Anon setter | |
| + * | |
| + * @access public | |
| + */ | |
| + function anon($anon) | |
| + { | |
| + $this->anon = $anon; | |
| + } | |
| + | |
| // -------------------------------------------------------------------- | |
| @@ -722,9 +736,18 @@ class Auth_result { | |
| { | |
| $expire = $this->remember_me; | |
| - $this->EE->functions->set_cookie( | |
| - $this->EE->session->c_anon, 1, $expire | |
| - ); | |
| + if ($this->anon) | |
| + { | |
| + $this->EE->functions->set_cookie( | |
| + $this->EE->session->c_anon, 1, $expire | |
| + ); | |
| + } | |
| + else | |
| + { | |
| + // Unset the anon cookie | |
| + $this->EE->functions->set_cookie($this->EE->session->c_anon); | |
| + } | |
| + | |
| $this->EE->functions->set_cookie( | |
| $this->EE->session->c_expire, time()+$expire, $expire | |
| ); | |
| diff --git a/system/expressionengine/modules/member/mod.member_auth.php b/system/expressionengine/modules/member/mod.member_auth.php | |
| index a3c277e..ac9bfbf 100644 | |
| --- a/system/expressionengine/modules/member/mod.member_auth.php | |
| +++ b/system/expressionengine/modules/member/mod.member_auth.php | |
| @@ -260,6 +260,10 @@ class Member_auth extends Member { | |
| $sess->remember_me(60*60*24*365); | |
| } | |
| + $anon = ($this->EE->input->post('anon') == 1) ? FALSE : TRUE; | |
| + | |
| + $sess->anon($anon); | |
| + | |
| $sess->start_session(); | |
| $this->_update_online_user_stats(); | |
| @@ -485,7 +489,7 @@ class Member_auth extends Member { | |
| // Update stats | |
| $cutoff = $this->EE->localize->now - (15 * 60); | |
| - $anon = ($this->EE->input->post('anon') == 1) ? 'n' : 'y'; | |
| + $anon = ($this->EE->input->post('anon') == 1) ? '' : 'y'; | |
| $in_forum = ($this->EE->input->get_post('FROM') == 'forum') ? 'y' : 'n'; | |
Hi Chad, the above code was to fix a forum bug: http://expressionengine.com/bug_tracker/bug/16092
If you're still having problems in 2.4, then I guess it's unrelated. What's the exact problem you're having?
Thanks for the response. Really stuck on this one...
I have an extension that redirects a user to a given template and logs them in automatically when they click on their activation link from the activation instructions email. In the activation email, I send a temporary password. When the user clicks the activation url, they are redirected to an update password form to immediately update their password. When you fill out the form (with the new password and current password) and submit, it always gives the error "The password you submitted was not correct". If you log out and log back in, the update password form works just fine.
I'm suspecting that my user isn't getting logged in properly in the auto-login method of the extension. Isn't the following code enough to get a user logged in?
$this->EE->session->create_new_session($member_id);Thanks again!
I think there's a little more to it, like setting cookies and things. Take a look at this add-on to see if it's useful to you, or look at the PHP they're using to log a user in: http://devot-ee.com/add-ons/logmein
Will do, thanks!
I stumbled across this as I'm trying to fix a weird issue I'm having when I call the following:
When debugging everything, the only difference I see is that the anon cookie is not set. Is what I'm seeing a symptom of the problem that the code above fixes?