pw encryption extended with sha. Minor freed-time changes

This commit is contained in:
ragu 2023-04-17 15:30:19 +02:00
parent 9b05eed19b
commit d6292aa09d
12 changed files with 104 additions and 128 deletions

View file

@ -215,11 +215,11 @@ sub save_account(){
if($_ =~ /^txt04/){
if($valxx eq "xxxxxxxx"){
$pw_dummy = "1";
}elsif($valxx){
my $pwmd5 = md5_hex($valxx);
my $pwsha256=sha256_base64($valxx);
$u_rows = $dbt->update_one($dbh,$update_primary,"txt11='$pwmd5'");
$u_rows = $dbt->update_one($dbh,$update_primary,"txt04='$pwsha256'");
}elsif(length($valxx) >= 8){
my $pwmd5 = md5_hex($valxx) || "";
$u_rows = $dbt->update_one($dbh,$update_primary,"txt11='$pwmd5'") if(length($pwmd5) > 20);
my $pwsha256=sha256_base64($pwmd5) || "";
$u_rows = $dbt->update_one($dbh,$update_primary,"txt04='$pwsha256'") if(length($pwsha256) > 20);
}
}
#operators, only if saved by operator DMS
@ -489,7 +489,6 @@ sub save_account(){
$alphacount = () = $valxx =~ /[a-z]/gi;
$alphafail = length($valxx) - $alphacount;
if(!$valxx || length($valxx) < 8 || $alphafail < 2){
#$ret = "failure::pwlazy_txt04#top";
$ret = "failure::$_#top";
}
}
@ -844,11 +843,11 @@ sub send_password(){
$email =~ s/\s//g;
$bw->log("$varenv{basedir}/src/Mod/newsletter_tink.pl",$email,"");
my $pwmd5 = md5_hex($coo);
my $pwsha256=sha256_base64($coo);#after migration, adjust length test
my $pwmd5 = md5_hex($coo) || "";
if($email && $email =~ /\w\@\w/ && $pwmd5 && length($pwmd5) > 20 && $email !~ /$dbt->{copri_conf}->{test_accounts}/i){
$db->updater("contentadr","1","1","txt11","$pwmd5","$owner","txt08","ilike","$email");
my $pwsha256=sha256_base64($pwmd5) || "";
$db->updater("contentadr","1","1","txt04","$pwsha256","$owner","txt08","ilike","$email");
system(`$varenv{basedir}/src/Mod/newsletter_tink.pl "$varenv{basedir}" "$varenv{wwwhost}" "send_password" "$email" "$coo"`);
}