Jump to content
  • 0
DennisHermannsen

Force user to logout during login

Question

Hi.

I'm currently building a module for WHMCS that allows clients to see a list of all logins and a list of unique logins.

In the table that shows unique logins, the client has an option to prevent a certain IP from logging in to the client's account.

I just need a way to force WHMCS to prevent the user from logging in. Any ideas?

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0
7 minutes ago, DennisHermannsen said:

I just need a way to force WHMCS to prevent the user from logging in. Any ideas?

I assume adding that IP to the Banned IP list is too global a solution and might cause issues as this check needs to be on a per client basis.

can you use a ClientLogin hook, get the user details, e.g whether it's a client/contact, get their IP and then check a table for this client/contact and IP address combination? if found, then redirect them to logout.php ??

Share this post


Link to post
Share on other sites
  • 0

I figured it out after some googling:

Session::delete("uid");
Session::delete("cid");
Session::delete("upw");
Cookie::delete("User");

Source: shhhhhhh

Oddly enough, there's no official documentation on this 😛

 

Share this post


Link to post
Share on other sites
  • 0
9 minutes ago, DennisHermannsen said:

Source: shhhhhhh

oh I know the resource of which you speak - it can often be an enlightening source. 💡

Share this post


Link to post
Share on other sites
  • 0
34 minutes ago, brian! said:

oh I know the resource of which you speak - it can often be an enlightening source

Dang it. I'm clueless, as usual. 

Share this post


Link to post
Share on other sites
  • 0

You could also just delete the session content:

add_hook('ClientLogin', 1, function($vars) {
    // if... then:
    $_SESSION = array ();
});

 

3 hours ago, DennisHermannsen said:

Source: shhhhhhh

😂

Share this post


Link to post
Share on other sites
  • 0
17 hours ago, string said:

You could also just delete the session content

Exactly, just unset($_SESSION['uid']);

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated