Pages: [1]
  Print  
Author Topic: password protected site  (Read 286 times)
arne
Gaia User
**
Posts: 34



« on: June 14, 2011, 05:41:24 AM »

Hi all,

I created a login/password page to limit access on the site i'm building.
What i'd like to do is redirect all access to this first page but don't really know how to do that?

Do you guys have any ideas, advises?

PS: i'm using MOD multilingual from Ramiro
Logged
steven
Gaia Author
Administrator
Gaia Evangelist
*****
Posts: 3871


gaiaframework
WWW
« Reply #1 on: June 14, 2011, 09:43:29 AM »

You can't enforce this in Flash with any reliability. You should use htaccess.
Logged

Steven Sacks | Gaia Author
Please support Gaia by donating to the project!  Smiley
arne
Gaia User
**
Posts: 34



« Reply #2 on: June 15, 2011, 01:24:41 AM »

Hi Steven,

ok - i'm going to search this way

have a good day
Logged
steven
Gaia Author
Administrator
Gaia Evangelist
*****
Posts: 3871


gaiaframework
WWW
« Reply #3 on: June 15, 2011, 01:37:12 AM »

If you wanted to do it purely in Flash, you could set a global variable.

Code:
public class GlobalData
{
    public static var authenticated:Boolean;
}

In Main.as...
Code:
GlobalData.authenticated = false;

In your login page, on successful login:
Code:
GlobalData.authenticated = true;

In Index page...
Code:
Gaia.api.beforeTransitionIn(checkAuthentication);

private function checkAuthentication(event:GaiaEvent):void
{
    if (!GlobalData.authenticated) Gaia.api.goto(Pages.LOGIN);
}

In site.xml, set indexFirst to true.

Code:
<site indexFirst="true">
Logged

Steven Sacks | Gaia Author
Please support Gaia by donating to the project!  Smiley
arne
Gaia User
**
Posts: 34



« Reply #4 on: June 15, 2011, 01:48:39 AM »

Oh yes that's the bomb! and clear!
thanx!

I lack OOP bases - but with your framework i can learn while working
that's great
Logged
mosk
Gaia Expert
****
Posts: 207


« Reply #5 on: June 23, 2011, 09:34:07 AM »

Hey Steven,

I understand that verifying in Flash won't offer the security of handling logins on the server side with php, but thanks for spelling out how to do this in such clear terms. 

In the very first code snippet where you create you class GlobalData and your static var authenticated, does that constitute its own as3 file - eg. GlobalData.as3

And you then use: import GlobalData in main.as, login.as, and index.as?

(sorry, I know that's more of a basic ActionScript question than Gaia, but I'm hoping to catch you in merciful spirits  Undecided  )

Thanks
Logged
steven
Gaia Author
Administrator
Gaia Evangelist
*****
Posts: 3871


gaiaframework
WWW
« Reply #6 on: June 23, 2011, 09:59:46 AM »

Yes.
Logged

Steven Sacks | Gaia Author
Please support Gaia by donating to the project!  Smiley
Pages: [1]
  Print  
 
Jump to:  

TinyPortal v1.0 beta 4 © Bloc