Titanium Community Questions & Answer Archive

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

'Redirect' to another window?

So at the top of "app.js" i have a little utility js file of mine that checks Titanium.App.Properties to see if the user is logged in

if not then I open a window that points to "login_form.js"

once I hit the server using an Ajax call, if the user validates, I write the results to the App.Properties and then I want to reopen/redirect to "app.js" so that this time it sees the values and knows the user is logged in

I thought createWindow and opening it was the answer, but it opens the window inside the current (and as a result, doesn't "reload" my utility file)

I'd like to "clear the stack" of windows/views and pretty much execute app.js fresh

any pointers?

thanks in advance

— asked May 5th 2010 by Stephen Gilboy
  • authentication
  • redirect
0 Comments

2 Answers

  • Why don't you split the process in 2 parts:

    if (not_logged_in) {  
        add view_login 
    } 
    else {
       remove( view_login);
       add  view_LOGGED_in
    }
    

    an you make all this in one window with 2 subviews - view_login and view_LOGGED_in, and of course the logic for this

    — answered May 5th 2010 by Dan Tamas
    permalink
    0 Comments
  • That is kinda what I have already

    app.js:

    • Load my utils.js (which checks Titanium.App.Properties for login info
    • If (LoggedIn)
      – add tab & window for Reporting
    • Else
      – add tab & window for Login Form (login.js)

    login.js

    • Form for username and password
    • Verify information
    • if (valid)
      – set Titanium.Apps.Properties values for login
      – ???? how do i "reload" app.js ???
    • else
      – give user a failed login message
    — answered May 5th 2010 by Stephen Gilboy
    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.