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
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Help] Login directly without type password?
#1
Question 
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
  Reply
#2
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.
  Reply
#3
(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
  Reply
#4
Awesome! Glad it helped!
  Reply
#5
By the way, what's the proper way to log-out a user?

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

Stonez56
  Reply
#6
Usually just
session_destroy();
Redirect::to('index.php');
  Reply
#7
(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
  Reply
#8
No problem!
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)