2. superdoc: activate_user( Int $user_id, Str $activation_hash )

I would accept a password as input here, rather than generate one as output. The password will be active long term (until the user changes it - possibly forever). The outbound page might be cached. While the inbound request might also be intercepted, it is less likely to be cached, reducing the exposure a little.

The new password could be an optional parameter. If not present with an acceptable value, display a form to enter the password. If an acceptable password is given, generate and store the hash, etc., then forward the user to the login page.

5. User settings

Just a nit: I guess this is the edit profile page.

The old password should be required here, so that a stolen login cookie / session is not sufficient to reset the password.

The only place it should be possible to set a new password without providing the old password is on the activation page. Access to this is restricted by the time limited activation hash sent by email only to the account owner.

6. # Everything/HTML.pm#::confirm_user

Maybe I don't understand what this is, in which case, just ignore the following. I am assuming this is user authentication on every page.

Requiring a password on every page increases the exposure of the password. Would it not be better to put a session key in the login cookie and authenticate the user with this session key? Ideally, the password would only be entered at the activation, login and password reset pages. Ideally, some day, these three pages would be SSL.

So, login goes like this:

my $ok; $hash = &generate_hash( $USER, $passwd ); # ... confirm via hash $ok = $hash eq $USER->{passwd_hash}; # if the hash-compare failed and the user still has a password, use th +at: if (! $ok and defined $USER->{passwd}) { $ok = $passwd eq $USER->{passwd} } if($ok) { # generate session key # save session key in ??? (user or session table) # send login cookie with session key - # for current browser session, # or a permanent one for cowboys }

Non login pages would then authenticate the user by comparing the provided session key with the stored key, without exposing the password.


In reply to Re: Steps for the migration to hashed passwords by ig
in thread Steps for the migration to hashed passwords by Corion

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.