*

rooman

  • ****
  • 231 posts
Restrict user login to one or two sessions at the same time
« on: March 15, 2023, 06:51:20 AM »
Hello
Is it possible to restrict a user's login to one or two sessions at the same time?
What I mean is that a user cannot log in with one email from two devices
Each user has one login from one or two devices only

What I see is that a user's mail cannot be used by many devices at the same time

Is this possible

*

MB Themes

Re: Restrict user login to one or two sessions at the same time
« Reply #1 on: March 15, 2023, 02:14:44 PM »
@rooman
When user login (validation successful), change it's secret (s_secret) code. That might drop existing session as it's s_secret will not match.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

rooman

  • ****
  • 231 posts
Re: Restrict user login to one or two sessions at the same time
« Reply #2 on: April 06, 2023, 04:16:12 PM »
i added in osclass>controller>login. php this code
Code: [Select]
User::newInstance()->updateLoginSecret($user['pk_i_id']);

The "updateLoginSecret" Code below
Code: [Select]
   public function updateLoginSecret($pk_i_id, $s_secret = '') {
     if($s_secret == '') {
       $s_secret = osc_genRandomPassword();
     }
     return $this->dao->update($this->getTableName(), array('s_secret' => $s_secret), array('pk_i_id' => $pk_i_id));
   }

but the s_secret is not change

*

MB Themes

Re: Restrict user login to one or two sessions at the same time
« Reply #3 on: April 08, 2023, 01:41:31 PM »
Try to specify table name
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots