From: Jean-Marc Pigeon (Delson) Date: Mon, 7 Jul 2025 19:42:35 +0000 (-0400) Subject: experience with trigger X-Git-Tag: tag-0.13~27 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=6fec7cffcdcf822cd0df51427b006ced102d17a9;p=jmp%2Fmailleur experience with trigger --- diff --git a/sql/mailleur.sql b/sql/mailleur.sql index 927868d..275c6d9 100644 --- a/sql/mailleur.sql +++ b/sql/mailleur.sql @@ -55,10 +55,11 @@ CREATE TABLE emails ( email TEXTUNIQUE, //User email password TEXT //User password DFLT '!', - realm TEXT //user realm - DFLT 'MAILLEUR-EMAIL', - hash TEXT //'email:realm:passwor' MD5 + realm TEXT //'email:realm:password' MD5 DFLT '0ABCD9', + seq BIGINT //HASH as a seq + DFLT 0, + hash TEXT, //'email:realm:passwor' MD5 space INTEGER //space used by user email DFLT 0, mxspace INTEGER //Maximun space available @@ -74,6 +75,7 @@ GRANT SELECT ON emails TO maildove; CREATE FUNCTION updpass() RETURNS trigger AS $$ BEGIN + NEW.seq = hashtextextended(md5(concat (NEW.email,':',NEW.realm,':',new.password)),0); NEW.hash = md5(concat (NEW.email,':',NEW.realm,':',new.password)); NEW.password = crypt(new.password, gen_salt('md5')); RETURN NEW;