The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
[Help] Login directly without type password? - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.4 (https://userspice.com/forums/forumdisplay.php?fid=27)
+--- Thread: [Help] Login directly without type password? (/showthread.php?tid=1440)



[Help] Login directly without type password? - stonez56 - 04-16-2019

Hi All,
I used UserSpice 4.4 in a sub-system within a fairly large portal system.
Now, I was asked to only authenticate once when users logged into the portal to be able to use the sub-system.
In other words, I couldn't ask user to login to UserSpiece in this sub-system again once they logged in to the portal.

I needed the permission by page features and would like to keep use UserSpice.
What's the best way to do this?

Here is what I came up with:

1.) User login to portal
2.) Get the "username" from the portal
3.) Use that "username" to automatically login to UserSpiece (without user typing ID, password again)
4.) Continue to use all features in UserSpiece 

Is this feasible?  How should I do this?

Thanks!

Stonez56


RE: [Help] Login directly without type password? - mudmin - 04-16-2019

Hi Stonez, I'm not sure exactly if I'm following, but the idea of being "logged in" to userspice is actually a lot simpler than it sounds.

Every time a userspice page loads session_start() is called in the init file and when you login, if your user id is one, logging in just sets $_SESSION['user'] = 1; So it really doesn't matter how you get to that point. You can login with username or email. You can get google or facebook to confirm your identity or you can even have another app on the same server do it.


RE: [Help] Login directly without type password? - stonez56 - 04-17-2019

(04-16-2019, 09:51 AM)mudmin Wrote: Hi Stonez, I'm not sure exactly if I'm following, but the idea of being "logged in" to userspice is actually a lot simpler than it sounds.  

Every time a userspice page loads session_start() is called in the init file and when you login, if your user id is one, logging in just sets $_SESSION['user'] = 1;   So it really doesn't matter how you get to that point.  You can login with username or email. You can get google or facebook to confirm your identity or you can even have another app on the same server do it.

Thank you for the quick reply! 
I looked into the $_SESSION and it does have $_SESSION['user'] = 1
Now, I don't have to worry whether I am FULLY logged-in with all the required parameters for UserSpice or not... Smile

By the way, what's the proper way to log-out a user?

Would this $_SESSION['user'] = 0 enough?

Thank you,
Stonez56


RE: [Help] Login directly without type password? - mudmin - 04-17-2019

Awesome! Glad it helped!


RE: [Help] Login directly without type password? - stonez56 - 04-18-2019

By the way, what's the proper way to log-out a user?

Would this $_SESSION['user'] = 0 enough?

Stonez56


RE: [Help] Login directly without type password? - mudmin - 04-18-2019

Usually just
session_destroy();
Redirect::to('index.php');


RE: [Help] Login directly without type password? - stonez56 - 04-19-2019

(04-18-2019, 09:27 AM)mudmin Wrote: Usually just
session_destroy();
Redirect::to('index.php');



Right, I forgot the need to destroy the session! 

Thank you!
Stonez56


RE: [Help] Login directly without type password? - mudmin - 04-19-2019

No problem!