Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Basic Login/Logout and App Flow

I'm just starting with Titanium Mobile and I'm having a hard time trying to get the correct structure to handle a Login and Logout mechanism.

A user may enter into the application in three different states.

  1. Logged out and no active 'session'
    In this case the user should see the the Login screen and successfully login and then set a 'session' pin before being allowed access to data on the device.
  2. Logged in but with an expired 'session'
    In this case the user should see a enter pin screen and successfully enter the sessions pin before being allowed access to the data on the device.
  3. Logged in with an active 'session'
    In this case the user the user will be into the application.

Playing around with the kitchen sink app everything drills down from the window created in app.js and then comes back to it. It's almost like I need to use the tabGroup but without tab buttons to be able to jump around to the various parts of the app.

It doesn't seem right that the Login window would have the main application as a child window or that it would chain to the pin screen which would chain to the main app. I don't want the user to go back to the login screen. They should be allowed to get back to the pin screen or some facsimile to choose a new pin if they like.

In what way do I go about creating this?

— asked July 7th 2010 by Michael Stack
  • iphone
  • windows
0 Comments

2 Answers

  • Here's the basic gist of how I handle it, and hopefully this can help. This is real brief, and I can elaborate on more specific points/code if you want:

    In app.js I have two tabGroups – a Login group and a Main group, each with their own windows. App.js checks to see if the session exists (Ti.App.Properties), and if it does, it opens the Main tabGroup. If it doesn't (or if the session datetime or whatever you're storing is too old), it loads the Login tabGroup.

    Once the user logs in, if the Login group was called, it closes that out and opens the Main group.

    — answered July 7th 2010 by Andrew Gioia
    permalink
    1 Comment
    • Hi Andrew, that idea seems good to me, I'm relative new in TI, can I ask you if you could provide some code example, please Andrew?

      Thanks!

      — commented October 23rd 2010 by Nuno Costa
  • A modal window with the login page would did the trick too I think.

    — answered July 7th 2010 by Dan Tamas
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.