Frage

I'm developing another GWT application, but this time I'm using GWT's MVP Activity, Place, etc. classes. My question is about the placement of "Are they signed in yet" check.

When a user enters the site using a link that contains the "dashboard" token/place it will take them to the DashboardActivity. However, before they can use the DashboardActivity they must first sign in. What is the best way to handle this?

1.) Place logic in the AppActivityMapper. So when converting places to activities, you perform the check there to see if they are signed in or not. If they are not signed in then return the SignInActivity object with a reference to the token/place to return to upon a successful sign in.

-- or --

2.) Create the dashboard activity as was requested, but within the dashboard activity do the check and if they are not signed in use the place controller to go to the sign in page? Then upon a successful sign in, just return them to the previous place in the place history?

War es hilfreich?

Lösung

The first choice is the better one :
you will do the check up before creating and loading new objects in memory and taking time
you will check directly if the user is registered and if so proceed with the new objects loading up, and if not you just forward him/her to the sign in page.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top