NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: pcrafton on February 28, 2008, 03:10:46 PM

Title: call login form on error condition
Post by: pcrafton on February 28, 2008, 03:10:46 PM
I have this code in the Validate Update 2 End embed:


!Get login credentials
 loclogin = upper(p_web.GetSessionValue('USERID'))
 locpwd   = upper(p_web.GetSessionValue('PWD'))
 If LocLogin <> ''
    access:pw.open()
    access:pw.UseFile()
    set(PW:KeyName,PW:KeyName)
    loginok = false
    PW:NAME=upper(p_web.getsessionvalue('USERID'))
    PW:PW=UPPER(p_web.getsessionvalue('PWD'))
    loop until Access:pw.Next()
    if upper(PW:NAME) = upper(loclogin) and upper(pw:pw) = upper(locpwd) then
      p_web.ValidateLogin()
      loginok = true
      break
    else
      cycle
    end
    end
 END
 if loginok = true then
    p_web.SetSessionLoggedIn(1)
    !stop('Logged In')
 elsif loginok = false
     p_web.SetSessionLoggedIn(0)
     stop('Not Logged in')
     packet = clip(packet)&'<!-- Net:LoginForm --><br /><H4> Login failed , please retry.</H4>'
     do SendPacket
 End !If
 access:pw.Close()

Everything works great except:

 at the loginok = false check I want to reload the LoginForm, but it is not working. Please advise of the proper way to do this

regards

Paul Crafton
Title: Re: call login form on error condition
Post by: Bruce on March 02, 2008, 11:56:50 PM
Hi Paul,

Example 7 has an example of the "standard" login, which does what you seem to be wanting... But I'm guessing you moved away from that approach for a reason?

Cheers
Bruce
Title: Re: call login form on error condition
Post by: pcrafton on March 03, 2008, 08:29:08 AM
Bruce:

no...actually example 3 and 7 do what I want, I just did not look closely at them. I changed my code to react to the alert and variable as explained in example 3.

Thanks