Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Starting with CGI::Application and Logins

by deep submerge (Scribe)
on Aug 22, 2004 at 13:43 UTC ( [id://384921]=note: print w/replies, xml ) Need Help??


in reply to Re: Starting with CGI::Application and Logins
in thread Starting with CGI::Application(::Session) and Logins

In your example, your starting run mode is the login screen. I thought the login screen was supposed to be determined in prerun? I saw an example somewhere, where the need to validate a user's login was supposed to the login. If it was good, it would go to the normal run mode. If it was bad, it would return $self->desiredrunmode.

And the wiki doesn't help either. It made some reference to a catch-all validation, that made a seperate C::A necessary. I see that you have everything in one pm...

See, I still don't understand what's going on, anywhere.

In your example, your start mode is login... And then your prerun is login... So how does the user get out of the login stage if they already were logged in?

Replies are listed 'Best First'.
Re^3: Starting with CGI::Application and Logins
by Zed_Lopez (Chaplain) on Aug 22, 2004 at 18:16 UTC

    Good question. I was fiddling with the code at the last minute and I made one of the classic mistakes -- putting a naked 'shift' into a hash parameter. So my login_required function, as written, didn't work, but (subsequent to breaking it) I hadn't tested the case of the user trying an end run around logging in by going to a run mode that required it.

    I've updated the code, and maybe my prerun makes more sense now that it's governed by a function that actually works.

    Updated: I wasn't really addressing all the questions, so I added the following...

    The example with the desired_runmode you mention does something nice that this example doesn't -- if the user's not logged in (perhaps because his or her session expired), it directs them to the login screen, while remembering where they wanted to be, and directing them there after they're logged in. That's functionality that just isn't here -- here, when they log in, they go to main, period. (Of course in this example there's literally nowhere else to go.)

    My prerun returns without action if they're going to a run mode that doesn't require being logged in, e.g. the login and create account run modes and the run modes that process the submission of those forms. Then, having determined they're going to a run mode that does require being logged in, it checks if they're logged in, and returns without action if they are. Finally, having eliminated the above cases, it knows that the user is going to a run mode that requires being logged in, and that the user is not logged in, so it directs the user to the login screen.

    I am a CGI::Application beginner myself, and have no idea why someone would say something actually required splitting the application into multiple C::A's. Can you provide a link to that assertion?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://384921]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-19 06:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found