Max Meter Posted January 8, 2018 Posted January 8, 2018 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?
bfarber Posted January 8, 2018 Posted January 8, 2018 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.
Max Meter Posted January 8, 2018 Author Posted January 8, 2018 I think using the SSO is what I will need to use ;). -Thanks anyway!
Max Meter Posted January 9, 2018 Author Posted January 9, 2018 @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?
bfarber Posted January 9, 2018 Posted January 9, 2018 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.
Max Meter Posted January 9, 2018 Author Posted January 9, 2018 @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"?
bfarber Posted January 10, 2018 Posted January 10, 2018 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).
Recommended Posts
Archived
This topic is now archived and is closed to further replies.