spatterson has asked for the wisdom of the Perl Monks concerning the following question:
I'm building a website that's open to anyone for viewing and that only authorised users can modify, using the following pseudocode for handling logins.
Have I left any obvious holes?
login - read username & password, check against database - if they're correct - create pseudo-random session ID - store session ID on database - return session ID in cookie - cookie lasts 1 hour - session ID on database lasts 1 hour (script for removal?) - else user is not logged in, gets view privs only checking login - to be done before any admin action - read session from cookie - if session exists on database, user is logged in, gets admin privs - else user is not logged in, gets view privs only - try to delete cookie logout - delete database session - try to delete cookie
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Cookie login (pseudocode)
by merlyn (Sage) on Feb 20, 2008 at 11:52 UTC | |
|
Re: Cookie login (pseudocode)
by moritz (Cardinal) on Feb 20, 2008 at 11:51 UTC | |
|
Re: Cookie login (pseudocode)
by Cody Pendant (Prior) on Feb 20, 2008 at 12:32 UTC | |
|
Re: Cookie login (pseudocode)
by DBAugie (Beadle) on Feb 20, 2008 at 12:49 UTC | |
by moritz (Cardinal) on Feb 20, 2008 at 13:18 UTC | |
by Akoya (Scribe) on Feb 20, 2008 at 15:32 UTC | |
by Spidy (Chaplain) on Feb 20, 2008 at 15:59 UTC | |
by hpavc (Acolyte) on Feb 20, 2008 at 17:55 UTC | |
by Anonymous Monk on Feb 21, 2008 at 00:08 UTC | |
|
Re: Cookie login (pseudocode)
by Anonymous Monk on Feb 20, 2008 at 11:53 UTC | |
|
Re: Cookie login (pseudocode)
by gwhite (Friar) on Feb 20, 2008 at 18:39 UTC |