Jump to content

using ipboard database for login


Max Meter

Recommended Posts

I'm using ipboard on the on side as a forum software. Now, because I work on an external plattform I would like the user credentials from ipboard for my external plattform too. How to perform a simple login check, using the username / email and password from ipboard database? How did the hashing of password for example work?

Link to comment
Share on other sites

This will change for 4.3, but on 4.2 you can do something like

try
{
	\IPS\Login\Internal::authenticate( array( 'auth' => 'username or email address', 'password' => 'plaintext password' ) );
	\\ Login succeeded
}
catch( \IPS\Login\Exception $e )
{
	// Login failed
}

If the login succeeded of course you'd then want to set appropriate cookies, etc.

Link to comment
Share on other sites

@bfarber

 

I'm using this code:

require_once '/var/www/html/ipboard/init.php';

        \IPS\Session\Front::i();

        if(\IPS\Member::loggedIn())
            dd("logged in");
        else
            dd("not logged into");

Code from: 

 

Seems like the loggedIn() function doesn't check if the user itself is logged into, since I only get "logged in" all the time. What's the best way to verify if a user is logged into to ipboard in an external application?

Link to comment
Share on other sites

 

@bfarber

5 hours ago, bfarber said:

The loggedIn() method returns the current user, which may be a guest object (but in any event, it always returns an object).

You need to check \IPS\Member::loggedIn()->member_id instead to see if the user is a logged in member or not.

Using:

dd(\IPS\Member::loggedIn()->member_id);

Returns null all the time, logged in and logged out. Are you sure it's "member_id"?

Link to comment
Share on other sites

Yes, I am positive. That indicates that you are not being detected as logged in. Without actually looking at your setup and code I can't be certain why (e.g. maybe you are running this script from a folder outside of your community and the cookie path is being set to your community path).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...