2 Comments

  1. Very in-depth post, thank you so much for sharing!

    One question I was left with was: What about when a user needs to reset their password? What updates are required to support handling the creation and insertion of a new hash for that user’s row? I went with the first suggested implementation, if that matters.

    1. Thank you, Aaron!

      Password reset actually means password change, or better: password UPDATE. However, the post examples use only INSERT triggers. You can update the trigger, on your own, to handle both: INSERT and UPDATE, (no matter of the trigger function implementation 1st or 2nd).

      e.g.:
      CREATE OR REPLACE TRIGGER “Hash_Password_insert-update_1”
      BEFORE INSERT OR UPDATE ON demousers
      FOR EACH ROW
      EXECUTE FUNCTION trigger_function_password_hash_1();

      Then, you can use an update SQL statement to change/reset the password of a user.

      Panos

Leave a Reply

Your email address will not be published. Required fields are marked *