X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Ft%2Fapi%2Fpassword-types.t;h=4cb634248512f13eb0bc9d99fefbd5251bace5a1;hb=a2df4ef9575be1ae2f1f5b9089f121316f796bac;hp=5f253d51eddae0534c4f7ee9a39dd8e3c5a332a0;hpb=f3c4966ed1f6ec3db7accd6dcdd3a5a3821d72a7;p=freeside.git diff --git a/rt/t/api/password-types.t b/rt/t/api/password-types.t index 5f253d51e..4cb634248 100644 --- a/rt/t/api/password-types.t +++ b/rt/t/api/password-types.t @@ -1,4 +1,3 @@ -#!/usr/bin/perl -w use strict; use warnings; @@ -39,3 +38,12 @@ my $trunc = MIME::Base64::encode_base64( $root->_Set( Field => "Password", Value => $trunc); ok($root->IsPassword("secret"), "Unsalted MD5 base64 works"); like($root->__Value("Password"), qr/^\!$default\!/, "And is now upgraded to salted $default"); + +# Non-ASCII salted truncated SHA-256 +my $non_ascii_trunc = MIME::Base64::encode_base64( + "salt" . substr(Digest::SHA::sha256("salt".Digest::MD5::md5("áěšý")),0,26), + "" +); +$root->_Set( Field => "Password", Value => $non_ascii_trunc); +ok($root->IsPassword(Encode::decode("UTF-8", "áěšý")), "Unsalted MD5 base64 works"); +like($root->__Value("Password"), qr/^\!$default\!/, "And is now upgraded to salted $default");