Revisiting index page after login - asp.net-mvc

I am new so please be willing to lend me a hand.
I am into a web application that a user needs to enter his credentials in a form set for the login page (index.aspx).
After he signs on, he'll be redirected to a content page (content-page-for-user-x.aspx).
He does open many more subpages and finally enters "index.aspx" in the browser to get back the index page.
What should I do to prevent the index.aspx (login form page) from showing up again? Because he is already in, not new at all. The index page now should be content-page-for-user-x.aspx.

In backend logic of login page index.aspx, you could check if user has already logged in.
If user has already logged in, just redirect user to content-page-for-user-x.aspx should be fine. If user not logged in, display your login page (index.aspx) to prompt user to login.

Related

Identity Server 3 Redirect to login page after logout

I've successfully been able to implement this using http://www.aaron-powell.com/posts/2015-01-11-auto-redirect-when-logging-out.html
But!
I'd like to be able to display a message similar to "You've been successfully logged out" once redirected back to login screen.
I've tried setting a session value in my logoff action method prior to going over to the sign in page... but then the session is still null in the LogonWorkflow --> Login.cshtml razor view.
Any suggestions? Help!

Rails/Devise: Force sign out & redirect on all pages when user session destroyed

I have a persistent error that keeps on popping up. Here's the use case:
User is logged in & has multiple tabs/windows of the app open.
User logs out (session is successfully destroyed) & is redirected back to home page (root_path).
User reloads or takes action on any of the other already open tabs.
User encounters error and must manually navigate to root_path via address bar.
Is there a best practice to prevent this altogether? Is it better to have an error page that has a link to the root path where they can log back in?
I appreciate any help at all. Thanks!
According to the documentation if a user is not authenticatable you can redirect to a specific page.
https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-when-the-user-can-not-be-authenticated
Maybe it is also helpful :
Redirect to log in page if user is not authenticated with Devise

edit my email when i login as guest and go to home page in rails using spree

I select an item and go to checkout
it will show login page.
In that page if, I entered as guest it will go to address page.
I leave checkout and go to the home page
I return to checkout
it is rendering address page not login page again.
You are back in address because you are still logged in as a guest.
If you don't want to be:
then logout
add to your cart
go to checkout again
it will then send you to the login page.

Losing Oauth Authorization When App Redirects to Page Tab

I'm using the Oauth redirect authorization method to provide authorization for a page tab iframe application.
The flow works like this:
User loads page tab (unauthorized)
User clicks authorize link
Authorization dialog takes over parent window
Accepted authorization redirects to my application to register user account using authorized email.
My application redirects back to the page tab
Loading the page tab causes authorization to be lost, and the user sees the authorize link again. Rinse, repeat, no success.
Confusingly, the application works completely if instead of redirecting to the Facebook Page Tab, I redirect to any path in my application (ie. the root, the user's page, etc.). Only by setting the redirect to the Facebook Page Tab URL does the user get "booted".
Even stranger, if I keep redirection limited to my application, but simply load the Facebook Page Tab, the authorization is killed everywhere. Meaning, post-facebook-page-load, refreshing the application off-Facebook will prompt the user to authorize again, and they are effectively "logged out" of my system.
I am using Rails 3.0.1 with Devise 1.4.2 for user accounts. The user authorization is passed to a Devise registration (I need to keep track of users in my app - a voting-based "contest" application). Devise uses the "Server side Flow" detailed here: http://developers.facebook.com/docs/authentication/
I'm lost as to what would be causing this. Facebook killing the auth cookie? Does this happen?
When you access the facebook tab page first time,signed_request is necessary:
#signed_request = oauth.parse_signed_request(params[:signed_request])
So you can send a parameter when redirect to it from other pages to check if it's the first time.

Get Current Page Information immediately after authorization when app is installed as a tab

My facebook application is installed on multiple pages as a tab.
When a user clicks on the tab link from a page, if the user has not authorized my app, I redirect the user for authorization.
After authorization, the user is redirected to my site with the "code" value. Now, at this point, I can get the "access token" for this user but I do not have the current page id.
I need the current page id in order to show the page specific data to this user.
However, after the user has authorized my user, when the user comes back later, i get the page information from the signed request. But I also need the page information immediately after authorization.
When your app first loaded as a tab, you can read the "signed_request" and compose the redirect_uri with it.
var encodeURI = encodeURIComponent("http://myapp.com?pageid=123");
and redirect your user to somewhere like
https://www.facebook.com/dialog/oauth?
client_id=YOUR_APP_ID&redirect_uri=encodeURI&response_type=token

Resources