Z
Z
Z_Coder2014-04-02 18:05:50
Yii
Z_Coder, 2014-04-02 18:05:50

Why do sessions crash after payment on the bank page?

The user enters the paid testing site, logs in, forms an order, and the user is billed, after which the user goes to the payment page of the bank serving us to pay by card.
Problem: After the payment is successfully made, the user presses the button on the bank's page "Return to the site", namely:

<input type="button" onclick="location.href="http://www.mysite.com/test"" value="Вернуться на сайт">

However, instead of getting to the testing page, the user again gets to the authorization page, since the session containing the user's data has crashed. It is noteworthy that after logging in this time and subsequent times everything works fine. But as soon as you click "Exit" on the site and try to pass the test again, the problem appears.
The site is made on Yii. Here is the UserIdentity code:
class UserIdentity extends CUserIdentity
{

    private $_id;

    public function authenticate()
    {

        $user=User::model()->findByAttributes(array('name'=>$this->username));
        if($user===null){
            $this->errorCode=self::ERROR_USERNAME_INVALID;
        }
        else if(!$user->validatePassword($this->password)){
            $this->errorCode=self::ERROR_PASSWORD_INVALID;
        }
        else
        {
            $this->_id=$user->id;
            $this->username=$user->name;
            if(!empty($user->role))
                $this->setState('role', $user->role);
            $this->setState('confirmed', $user->confirmed);
            $this->errorCode=self::ERROR_NONE;
        }
        return $this->errorCode==self::ERROR_NONE;
    }


   public function getId()
    {
        return $this->_id;
    }
}

I tried to save a regular session like $_SESSION[""], but it is also reset after returning from the bank to the site.
Spent an hour trying to solve this problem. What can be wrong? Maybe someone has come across this? How to solve it? If any code is missing, please let me know.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
davidnum95, 2014-04-02
@davidnum95

See how it's done here https://github.com/ikeagold/yii-user

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question