NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: kingja on December 13, 2012, 10:34:30 AM

Title: NT 6 to NT 7 app upgrades
Post by: kingja on December 13, 2012, 10:34:30 AM
Bruce,

     I'm upgrading all my NT 6 apps to NT 7.  I have run into 2 issues so far:

1.  All my login forms are now left justified.  I have been tinkering with FireBug to see if I can find the cause but so far no luck.

2.  Two of my apps use the technique to store a hash of the password in the user.tps file.  After conversion, I find I cannot log into these apps with the known user name and password.  There is no error message, I'm simply left at the login screen.  I have attached a sample of the code embedded in the login form, that worked in the NT 6.45 version of the app.  Has something changed in StringTheory or Cryptonite?

By the way, all my apps are compiled as a DLL for use with the Multi-Site host app. 

Also, the test app I sent you last week is one I'm trying to convert and can't log into.  If you could recompile that with NT 7, you should see this issue.

Thanks,

Jeff King

[attachment deleted by admin]
Title: Re: NT 6 to NT 7 app upgrades
Post by: MikeR on December 13, 2012, 11:27:23 AM
My logins dont work either, nothing special ???
Title: Re: NT 6 to NT 7 app upgrades
Post by: kingja on December 13, 2012, 11:57:36 AM
Mike,

     I found that if I uncheck "Delete session on logout" and "Change session on login/logout", then I can log in again.  I tried different combinations of these and it seems that just unchecking "Delete session on logout" allows logins to continue.  This bothers me as I prefer the session be deleted on logout.  Hopefully Bruce can resolve this quickly.

Jeff
Title: Re: NT 6 to NT 7 app upgrades
Post by: markster on December 13, 2012, 02:21:07 PM
Same problem with me. Once I unchecked the "Delete session on logout" it worked. When that item IS checked, in my app the procedure processing completely bypasses the ValidateUpdate routine where the actual login validation coding is.

Mark
Title: Re: NT 6 to NT 7 app upgrades
Post by: markster on December 13, 2012, 02:35:44 PM
Sorry, forgot to mention the procedure I was talking about is the LogInForm.

Note: I opened the Web3 example, compiled it in NT7, and the login worked properly with the call to ValidateUpdate processed, even with the "delete session on logout" checked in the WebServer.

Mark
Title: Re: NT 6 to NT 7 app upgrades
Post by: MikeR on December 13, 2012, 03:49:09 PM
Thanks Works, in that it logs on but the alert message doesnt appear ?
Title: Re: NT 6 to NT 7 app upgrades
Post by: kingja on December 13, 2012, 04:39:12 PM
Mike and Mark,

     Are either of you Hashing the password?  I'm storing the hash back into my user file and thought it might have something to do with CryptoNite and StringTheory.  If not, then there is some other reason it is bypassing the ValidateUpdate or perhaps the ValidateLogin() routine.

Jeff
Title: Solved - Re: NT 6 to NT 7 app upgrades
Post by: kingja on December 13, 2012, 05:51:07 PM
Mike and Mark,

     I compared my 2 apps with the latest Web3 example.  In my apps I have the following code in the GenerateForm/Start embed:

! change the 'save' button so it says 'login'
p_web.site.SaveButton.TextValue = 'Login'

! coming to the login screen automatically logs the user out.
! Note that logging out does not delete the session.

p_web.SetSessionLoggedIn(0)


     The last line, p_web.SetSessionLoggedIn(0), is not present in the latest example.  Commenting out this code has solved the problem.  Most of the NT apps I create are based on a few of the example apps.  This line was probably in one of the earlier examples and has not been a problem until NT 7.

     Now, the only remaining issue is that the login form opens on the left instead of centered, as it did in NT 6.45.  Also, when I log out, the login form reappears on the left.  In the NT 6.45 version of my apps, it only appears when I select Login from a menu.  Still looking into this issue.

Thanks,

Jeff
Title: Re: NT 6 to NT 7 app upgrades
Post by: Bruce on December 13, 2012, 10:35:23 PM
Hi Guys,

Thanks for the feedback - and also the analysis.

So this bit of code;

! coming to the login screen automatically logs the user out.
! Note that logging out does not delete the session.
p_web.SetSessionLoggedIn(0)


is incompatible with "Delete session on logout" because effectively it means that the session values _of the login form_ set before this line are being cleared. So the login basically doesn't work right. My recommendation is like Jeff's - remove the line. (or turn off "delete session on logout).

Regarding the centering of the login window;
go to the Web Server procedure, Settings / Styles / Site tab. remove the Content Body Div Class set there (it's defaulting to 'nt-left'.)
I don't _think_ this will have an impact on the rest of the system, but please keep an eye out for any other style problems and let me know if there are any.

cheers
Bruce


Title: Re: NT 6 to NT 7 app upgrades
Post by: kingja on December 14, 2012, 12:39:03 PM
Bruce,

     Thanks!  All is back to "normal".  I'll finish testing the other converted apps and report back here if I find any issues. 

Jeff
Title: Re: NT 6 to NT 7 app upgrades
Post by: markster on December 17, 2012, 01:29:06 PM
Deleting the handcode referred to above and checking on the Delete Session on Login corrects the log in issue.

However, I have discovered another issue which was not present before in NT6. When you log in, several additional menu buttons appear in the menu at the top of the page. I'm using a menu extension in the PageHeaderTag proc and these menu items are all dependent on the user being logged in.

In NT6, when I clicked on my Log Out button, these menu items would disappear, as they should.

In NT7, they do not disappear.

Mark
Title: Re: NT 6 to NT 7 app upgrades
Post by: JPMacDonald on December 17, 2012, 05:49:34 PM
Mark/Bruce,

I am seeing the same behaviour in my application, the menu options do not disappear and will still launch the procedure coded behind the menu selection after logout.

In addition to that I have code embedded in the Webhandler/DeleteSession embed point to do some cutom cleanup of memory tables etc. and that is no longer getting invoked when the user logs out.

Regards

Parker
Title: Re: NT 6 to NT 7 app upgrades
Post by: Bruce on December 17, 2012, 11:13:50 PM
Tell me more about your "Log Out" button. What does it do? What URL does it have? does it go straight to the Login form?
Is it a button or a menu item?

Cheers
Bruce
Title: Re: NT 6 to NT 7 app upgrades
Post by: JPMacDonald on December 18, 2012, 04:33:37 AM
Bruce,

In my case the Logout is a menu option generated from the Wizard in the original NT6 app.

In the "or Procedure" section it names LoginForm as the action to take when selected.

Regards

Parker
Title: Re: NT 6 to NT 7 app upgrades
Post by: bruce2 on December 18, 2012, 05:30:32 AM
yeah, I thought maybe it was. Ok, remember that we removed the "logout" line from the Login page? That means that just going to the logout page no longer logs you out. You'd need to go to an actual "logout" page to do that.

So maybe make a netwebpage.
Put a "thanks for coming" type message on it.
and move the p_web.SetSessionLoggedIn(0) call there.

Then you'll probably need to adjust the Header on that page so that it shows a reduced set of menu options.

cheers
Bruce
Title: Re: NT 6 to NT 7 app upgrades
Post by: kingja on December 18, 2012, 08:11:09 AM
I have the same issue....most of my apps were created with the app wizard and thus have just the login page.  In NT6 apps, this was the only page used during login and log out. 

Looking at the web3 example, I noticed a new logout form page.  It has embedded code to log out and delete the session.  So I copied this form page to my apps.  It does the log out and deletes the session and no stray menu items remain when they should not.  However, if I try to use this as a pop up, it does not work.

I also noticed in the web3 example, there is an option to logout with JavaScript code.  So I started adding this to my NT7 apps and now my logouts behave as they did in NT6.

Thanks,

Jeff
Title: Re: NT 6 to NT 7 app upgrades
Post by: JPMacDonald on December 18, 2012, 08:49:32 AM
Bruce,

Using my own logout page with a confirmation request "Are your sure..." works and now my cleanup embed gets executed and the menu items are taken care of.

However, if the browser session times out the user is automatically redirected to the Login Form and now my cleanup code does not get executed and the menu items are all still visible.

Any clues on how to handle logout logic when the session times out?

Regards

Parker
Title: Re: NT 6 to NT 7 app upgrades
Post by: JPMacDonald on December 18, 2012, 09:30:07 AM
Bruce,

Not sure if you would approve of this approach or not but here is a work around for me, I am sure you will have a more elegant solution.

Created a new Procedure called LogoutRedirect
    In the XHtml after head I put this code (angle brackets not shown but should be there)
        meta HTTP-EQUIV="REFRESH" content="0; url=indexpage"
    Gave the Routine the name of Redirect

In the Redirect Routine embed code I put the p_web.SetSessionLoggedIn(0)

In the WebServer settings I changed my LoginPage to: LogoutRedirect (that feels counter intuitive doesn't it?) This will catch the session timeout.

In the Logout Menu Item I set the procedure to LogoutRedirect as well.

Now both scenarios seem to be coverd and my cleanup code gets called regardless of the user selecting to logout or if the session times out.

Since the Redirect is to a page within the same site web browsers shouldn't complain about the redirection, or so I hope.

Regards

Parker
Title: Re: NT 6 to NT 7 app upgrades
Post by: JPMacDonald on December 18, 2012, 11:08:29 AM
Damn, forgot the 3rd scenario, when a user just abondons the page by closing the browser and walks away, under that conditin my cleanup code does not get executed.

Back to the drawing board.

Parker
Title: Re: NT 6 to NT 7 app upgrades
Post by: Bruce on December 18, 2012, 10:53:40 PM
>> Damn, forgot the 3rd scenario, when a user just abondons the page by closing the browser and walks away, under that conditin my cleanup code does not get executed.

If your clean-up code is in the DeleteSession method then it'll get called when the session times out - which is what will happen if they just walk away.

cheers
Bruce
Title: Re: NT 6 to NT 7 app upgrades
Post by: JPMacDonald on December 19, 2012, 07:06:46 AM
Bruce,

Of course you are correct, the routine is getting called on the timeout but here is what I discovered in my app.

I have a couple of in-memeory tables that I use for "tagging" records and for special filters I use throughout the application. The code below is part of my cleanup process and it works if the user logs out, if the session times out with the browser open, but does not delete anything from the memory tables if they just close the browser.

RemoveEmpFilters     ROUTINE
   FIL:SessionID = Clip(p_web.SessionID)
   FIL:FilterID  = ''
   SET(FIL:Primary,FIL:Primary)
   LOOP
      Access:Filters.Next()
      IF Errorcode() THEN BREAK.
      IF FIL:SessionID <> p_web.SessionID THEN BREAK.
      Access:Filters.DeleteRecord(0)
     p_web._Trace('Actually Deleted a filter')
   END

I've changed this to NOT use the ABC File manager syntax so it now looks like this and now it seems to work (I'll need to test it more to be sure).

   OPEN(Filters)
   FIL:SessionID = Clip(p_web.SessionID)
   FIL:FilterID  = ''
   SET(FIL:Primary,FIL:Primary)
   LOOP
      Next(Filters)
      IF Errorcode() THEN BREAK.
      IF FIL:SessionID <> p_web.SessionID THEN BREAK.
      Delete(Filters)
     p_web._Trace('Actually Deleted a filter')
   END

Regards

Parker
Title: Re: NT 6 to NT 7 app upgrades
Post by: JPMacDonald on December 23, 2012, 12:30:15 PM
Hi all,

I need to declare my "fix" to this as unstable at the moment.

While the code seemed to work for all 3 exit scenarios (menu Logout, browser timeout, and browser close) the web server hangs after a short period so my code is not a workable fix.

I think it best if I start from square one.

Regards

Parker