DOWNLOAD DEMO
Current Version: 2.3.9.7 2013-04-30
Need a hand? Join the community.

UserID for logged in user

This thread is closed to new posts. You must sign in to post in the forums.
5/7/2012 1:52:33 PM
Gravatar
Total Posts 8

UserID for logged in user

We would like to access the "USERID" as well as the Email address of the currently logged in user.

Specfically we need pass this information thru the URL on the Create new Page in the Admin page settings section to make that part of the main navigation

example http://www.mywebsite.com/login.aspx?userid=$userID$

something along those lines, is this possible or are there any other ideas out there that will allow for this?

5/7/2012 3:58:08 PM
Gravatar
Total Posts 16720

Re: UserID for logged in user

Hi,

I don't really understand your question or what you are trying to do, your questions don't really make sense to me.

For the current logged in user you can get his LoginName (its just labeled UserID on the login screen or hist actual UserID which is an integer from code as follows:

SiteUser currentUser = SiteUtils.GetCurrentSiteUser();

string loginName = currentUser.LoginName;

int userId = currentUser.UserID;

I don't know what you mean about passing it from Page Settings or making it part of navigation, you should not be modifying mojoPortal code.

I cannot imagine why you would need to pass anything to a custom login page for a user who is already logged in and passing things like loginname in the query string would not be good security, the main reason to use LoginName (ie it is what users use to login when Use Email for Login is NOT checked in Site Settings and the only benefit of using that is that it is less guessable than email).

Hope that helps,

Joe

5/8/2012 5:17:38 PM
Gravatar
Total Posts 8

Re: UserID for logged in user

Thanks Joe, what I am trying to do is avoid the user from needing to login to another system of ours. We have a proposal creation system that the staff and advisors use and we wanted to add that to the navigation of the mojoportal site we run. For example XYZ Proposal would then link to our proposal system and allow for them to access it so long as they were already logged into mojoportal. We were hoping to do that with a session variable, reading in a cookie or some other means to treat it as a single sign on. Does that make more sense?

5/11/2012 9:24:23 AM
Gravatar
Total Posts 8

Re: UserID for logged in user

Are there any ideas out there to accomplish something like this without the modification of the mojo portal code base?

5/11/2012 9:36:36 AM
Gravatar
Total Posts 16720

Re: UserID for logged in user

If your other app is running as an IIS application in a folder beneath a root site running mojoPortal and in the same domain then you should be able to access cookies between them, though you won't be able to read the authentication cookie from mojoPortal in the sub app since it is encrypted using the machine key. You could potentially set an extra cookie by implementing a custom user sign in event handler in mojoPortal, and then read the custom cookie in the sub app and use that to log them in to the sub app.

I don't know if you can share session state between them, I definitely would not implement something that does an automatic login based on a query string param as that would be very insecure.

Hope that helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.

mojoPortal Hosting Made Easy

Go Mobile with mojoPortal and Mobile Kit Pro!