Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: possible to repeat if statement?

by davido (Archbishop)
on May 04, 2013 at 16:26 UTC ( #1032057=note: print w/replies, xml ) Need Help??

in reply to [SOLVED] possible to repeat if statement?

It's been years since I last did bare CGI, so with that in mind here goes... Invert the logic a little, and use a loop that blocks further progress until the user authenticates. Pseudo-code follows:

while( ! defined $cookies{'authorized'} ) { if( param ) { if( validates ) { # Set authorization cookie next; # Auth check will pass, so this is # equiv to "last" } } # If we get here, the user hasn't successfully validated # Generate auth form. } # To arrive here we must have authenticated: Redirect.

If you have creative control on this project, it seems that you're early enough along in the process that you could just ditch and run straight to Mojolicious::Lite, which will run in a CGI environment, but will greatly promote de-spaghettification of your code, and makes auth checks almost free.


Replies are listed 'Best First'.
Re^2: possible to repeat if statement?
by Anonymous Monk on May 07, 2013 at 12:01 UTC

    Genius thanks a lot

      puts you in an infinite loop of generating login forms.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1032057]
NodeReaper shuffles a deck of punched cards

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2018-02-24 16:39 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (310 votes). Check out past polls.