Welcome Guest, Not a member yet? Register   Sign In
Tank Auth Activation Problem
#1

[eluser]mindriot[/eluser]
Hey, i'm having issues with tank auths email activation.

The user registration and email activation works fine on a local server, but as soon as I pushed it onto my live server the activation is being weird.

The email link to the activation looks fine and the uri segments are right, but it seems to be running the activate function twice. So the user is getting activated, but then for some reason activate is being run again and hitting the else statement. This isn't ideal as an activated user is being greeted with the message "The activation code you entered is incorrect or expired".

Code:
function activate()
{
  $user_id  = $this->uri->segment(3);
  $new_email_key = $this->uri->segment(4);

  // Activate user
  if ($this->tank_auth->activate_user($user_id, $new_email_key)) {  // success
   log_message('debug', 'in if of activate');
   $this->tank_auth->logout(TRUE);
   $this->_show_message($this->lang->line('auth_message_activation_completed').' '.anchor('/auth/login/', 'Login'));

  } else {  
   log_message('debug', 'in ELSE of activate');             // fail
   $this->_show_message($this->lang->line('auth_message_activation_failed'));
  }
}

Any ideas? I've been trying to solve this for the last 5 hours. I thought maybe it might be the time zones on my live server not being set right so I tried adding date_default_timezone_set() to index.php in the root dir. Also tried adding timezone ENV to the .htaccess in the root but neither fixed the error.

HELP Sad
#2

[eluser]mindriot[/eluser]
Day 2: Still having the same problem..

have tried 2 custom Session classes
recreated all the tank auth files again
recreated the whole database again
renamed ci_sessions to cisessions
tried turning CSRF protection off

I set date_default_timezone_set('Pacific/Auckland'); in my config.php
and in the .htaccess at root level I have SetEnz NZ Pacific/Auckland

My hosting is in Texas, with hostgator and I noticed that the modified date in the user table is getting set a day late. Where as on my localserver is setting to the right time.

i'm starting to think it might be the timezone of my hosting? but I thought i had that covered..
#3

[eluser]mindriot[/eluser]
Day 3:

a breakthrough!

After bashing my head against a wall for a number of hours I realised something..

If I copy paste the url from the activation email into the same window that I registered in. The right activation message appears!

.. but this isn't so user friendly. As I imagine users will be more than inclined to do what I did and click the link that is sent in the email. Which for both hotmail and gmail opens a new window. This results in the activation function being run twice and displaying the "the activation code you entered is incorrect or expired" message.

So what the heck is triggering this? what is it about a new window opening that is throwing the auth controller off?




Theme © iAndrew 2016 - Forum software by © MyBB