Jquery redirect to internal page

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
11/27/2012 7:16:01 AM
Gravatar
Total Posts 2

Jquery redirect to internal page

Hi,

I've created a mojo site for my client who only want authenticated users to access the site.

I've installed an existing jquery login function which I had already developed that authenticates against a separate SQL database. On successful login I want to redirect the user to the homepage but using a javascript or jquery redirect doesn't work.

Using Fiddler I can track that it attempts to redirect to my homepage (homepage.aspx) but then serves a 302 (object moved) and sends me back to logoff.aspx, clears down my session and sends me back to me login page.

The page definitely exists as I can get to it directly in a browser.

The redirect sits inside a jquery function (see below)

$(document).loginmanager().bind('loggedin', function () {

var url = '/homepage.aspx';

$(location).attr('href', url);

});

Bizarrely, the redirect works if I use an external url!
Is it not possible to redirect this way to a mojo page? If so, how else can I redirect the user on successful login?

Any help would be greatly appreciated.

Thanks

11/30/2012 11:45:09 AM
Gravatar
Total Posts 18439

Re: Jquery redirect to internal page

Hi,

It isn't clear to me how your custom authentication works with mojoPortal. Are you setting an auth token, are you creating a site user in the mp_Sites table, those thing would be needed. If the page is protected by roles and the user is not authenticated from mojoportal's point of view they would be redirected to login.

If mojoPortal detects an authentication cookie but cannot retrieve a corresponding site user from the database it will redirect to logout the user and force him to login again. This can also happen if a user changes the email address on their account (or login name if not using email for login) from one web browser while still logged in from another web browser. This happens by design because the user is looked up in the database based on the name in the auth cookie so if the user changes it from a different web browser then the user is not found in the other web browser since it no longer matches his email or login name.

So my best guess is you are not creating a mojo site user corresponding to the custom authentication. In mojoPortal when using LDAP or Active Directory, or when using Windows Authentication for example we automatically create a site user if one does not exist upon authentication. You would need to do the same in your custom solution.

Hope that helps,

Joe

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